Trying to install scrapy with pip lxml error: command 'gcc' failed with exit status 1
Tue 01 November 2011 | Last updated on Tue 06 December 2022Just tried to install scrapy with pip / easy_install, but when it comes to installing lxml it will give the following error:
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
In file included from src/lxml/lxml.etree.c:239:0: src/lxml/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: No such file or directory compilation terminated.
error: command 'gcc' failed with exit status 1
The solution
Install Python development package:
sudo apt-get install python-dev
Install the development packages of libxml and libst
sudo apt-get install libxml2-dev
sudo apt-get install libxslt1-dev[/sourcecode]