在lxml安装期间出现python gcc和setuptools错误

时间:2017-06-03 23:37:50

标签: python linux gcc centos lxml

我正在尝试在centos(amazon linux AMI)上安装LXML。

我已经安装了以下先决条件:

sudo yum install libxml2-devel libxslt-devel
sudo yum install zlib-devel
sudo pip install setuptools
sudo yum install python-devel

然后我用:

安装lxml
sudo pip install lxml

我收到以下gcc错误:

  

创建build / temp.linux-x86_64-2.7 / src / lxml       gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE = 2 -fexceptions -fstack-protector -param = ssp-buffer-size = 4 -m64 -mtune = generic -D_GNU_SOURCE - fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE = 2 -fexceptions -fstack-protector -param = ssp-buffer-size = 4 -m64 -mtune = generic -D_GNU_SOURCE -fPIC -fwrapv - fPIC -I / usr / include / libxml2 -Isrc / lxml / includes -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       {standard input}:汇编程序消息:       {标准输入}:593226:错误:未知的伪操作:`.lc1'       gcc:内部编译器错误:已杀死(程序cc1)       请提交完整的错误报告,       如果合适,使用预处理的来源。       有关说明,请参阅http://bugzilla.redhat.com/bugzilla。       编译失败:命令' gcc'退出状态失败4       创造tmp       cc -I / usr / include / libxml2 -I / usr / include / libxml2 -c /tmp/xmlXPathInit0HczkK.c -o tmp / xmlXPathInit0HczkK.o       cc tmp / xmlXPathInit0HczkK.o -L / usr / lib64 -lxml2 -o a.out       错误:命令' gcc'退出状态4失败

----------------------------------------
     

命令" /usr/bin/python2.7 -c"导入setuptools,   tokenize; file =' /tmp/pip-build-TmaL5z/lxml/setup.py' ;; exec(compile(getattr(tokenize,' open',打开)(文件)。read()。replace(' \ r \ n',' \ n'),文件 ,   ' EXEC'))"安装--record /tmp/pip-OD8Xpx-record/install-record.txt   --single-version-external-managed --compile"在/ tmp / pip-build-TmaL5z / lxml

中出现错误代码1失败

我的gcc版本是: gcc(GCC)4.8.3 20140911(Red Hat 4.8.3-9)

我的python版本是: Python 2.7.12

如何通过此错误安装LXML?

1 个答案:

答案 0 :(得分:0)

我安装了上面提到的那些:

sudo yum install libxml2-devel libxslt-devel
sudo yum install zlib-devel
sudo pip install setuptools
sudo yum install python-devel

这两个做了诀窍:

sudo yum install glibc-devel glibc-headers
Sudo yum groupinstall "Development tools”



sudo pip install lxml