2014-10-03 67 views
2

我在CentOS-6上安装lxml时遇到了一些问题。我尝试了一些类似问题的解决方案,例如pip install lxml errorSetup.py: install lxml with Python2.6 on CentOS,但这些都不起作用。如何正确安装? 发行后,gcc lxml安装时出现内部错误CentOS

pip install lxml 

日志是这样的,

Downloading/unpacking lxml 
    Running setup.py egg_info for package lxml 
    /usr/lib64/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'bugtrack_url' 
     warnings.warn(msg) 
    Building lxml version 3.4.0. 
    Building without Cython. 
    Using build configuration of libxslt 1.1.26 
    Building against libxml2/libxslt in the following directory: /usr/lib64 
Installing collected packages: lxml 
    Running setup.py install for lxml 
    /usr/lib64/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'bugtrack_url' 
     warnings.warn(msg) 
    Building lxml version 3.4.0. 
    Building without Cython. 
    Using build configuration of libxslt 1.1.26 
    Building against libxml2/libxslt in the following directory: /usr/lib64 
    building 'lxml.etree' extension 
    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 -I/tmp/pip-build-root/lxml/src/lxml/includes -I/usr/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.6/src/lxml/lxml.etree.o -w 
    gcc: Internal error: Killed (program cc1) 
    Please submit a full bug report. 
    See <http://bugzilla.redhat.com/bugzilla> for instructions. 
    error: command 'gcc' failed with exit status 1 
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-07a07D-record/install-record.txt --single-version-externally-managed: 
    /usr/lib64/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'bugtrack_url' 

    warnings.warn(msg) 

Building lxml version 3.4.0. 

Building without Cython. 

Using build configuration of libxslt 1.1.26 

Building against libxml2/libxslt in the following directory: /usr/lib64 

running install 

running build 

running build_py 

copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-2.6/lxml/includes 

running build_ext 

building 'lxml.etree' extension 

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 -I/tmp/pip-build-root/lxml/src/lxml/includes -I/usr/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.6/src/lxml/lxml.etree.o -w 

gcc: Internal error: Killed (program cc1) 

Please submit a full bug report. 

See <http://bugzilla.redhat.com/bugzilla> for instructions. 

error: command 'gcc' failed with exit status 1 

---------------------------------------- 
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-07a07D-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-root/lxml 
Storing complete log in /root/.pip/pip.log 

回溯在pip.log

Exception information: 
Traceback (most recent call last): 
    File "/usr/lib/python2.6/site-packages/pip/basecommand.py", line 139, in main 
    status = self.run(options, args) 
    File "/usr/lib/python2.6/site-packages/pip/commands/install.py", line 271, in run 
    requirement_set.install(install_options, global_options, root=options.root_path) 
    File "/usr/lib/python2.6/site-packages/pip/req.py", line 1185, in install 
    requirement.install(install_options, global_options, *args, **kwargs) 
    File "/usr/lib/python2.6/site-packages/pip/req.py", line 592, in install 
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False) 
    File "/usr/lib/python2.6/site-packages/pip/util.py", line 662, in call_subprocess 
    % (command_desc, proc.returncode, cwd)) 
InstallationError: Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-cAMY23-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-root/lxml 

我对CentOS release 6.5使用Python 2.6.6

回答

0

在清新的环境设置/包安装是一个可能面临的最常见的问题如下:

  1. gcc未安装 - 需要建立Python包为核心的是C一个C编译器。

    $sudo yum install gcc

  2. 错误:命令‘GCC’与退出状态失败1”发生时没有找到头文件(#包括),即依赖未安装

    解决方案:安装系统级依赖(开发软件包)

    $sudo yum install libxml2-devel libxml++-devel libxslt-devel

  3. ,而在你r case,'gcc:内部错误:Killed(程序cc1)'不能是上述可能性,依赖关系存在,因为没有找到任何缺少头文件的“未找到”错误或任何其他语法级错误。 发生了什么(可能),gcc编译器崩溃。存在相当多的可能性,这是一个内存问题,即内存不足。

    尽管您没有提到您是否设置了虚拟机或本机安装 - 通常我们在设置虚拟机时分配有限的内存。如果您使用虚拟机,可能的解决方法是增加为虚拟机分配的内存空间,或通过关闭任何不必要的正在运行的程序和服务来释放内存。

P.S.我在安装lxml时遇到了同样的问题,并用更多的内存解决了它。

相关问题