gpt4 book ai didi

python - 无法在 CentOS 上安装 lxml

转载 作者:行者123 更新时间:2023-12-04 19:32:48 24 4
gpt4 key购买 nike

我正在尝试安装 lxml但有一些困难:

[root@ip-xx-xxx-xx-113 init.d]# 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.3.0.beta2.
Building without Cython.
Using build configuration of libxslt 1.1.26
Building against libxml2/libxslt in the following directory: /usr/lib64
warning: no files found matching '*.py' under directory 'fake_pyrex'
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.3.0.beta2.
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
src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_11TreeBuilder_4data’:
src/lxml/lxml.etree.c:102248: warning: passing argument 1 of ‘__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxData’ from incompatible pointer type
src/lxml/lxml.etree.c:101849: note: expected ‘struct __pyx_obj_4lxml_5etree_TreeBuilder *’ but argument is of type ‘struct __pyx_obj_4lxml_5etree__SaxParserTarget *’
src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_11TreeBuilder_6start’:
src/lxml/lxml.etree.c:102385: warning: passing argument 1 of ‘__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxStart’ from incompatible pointer type
src/lxml/lxml.etree.c:101549: note: expected ‘struct __pyx_obj_4lxml_5etree_TreeBuilder *’ but argument is of type ‘struct __pyx_obj_4lxml_5etree__SaxParserTarget *’
src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_11TreeBuilder_8end’:
src/lxml/lxml.etree.c:102443: warning: passing argument 1 of ‘__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxEnd’ from incompatible pointer type
src/lxml/lxml.etree.c:101773: note: expected ‘struct __pyx_obj_4lxml_5etree_TreeBuilder *’ but argument is of type ‘struct __pyx_obj_4lxml_5etree__SaxParserTarget *’
src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_11TreeBuilder_10pi’:
src/lxml/lxml.etree.c:102601: warning: passing argument 1 of ‘__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxPi’ from incompatible pointer type
src/lxml/lxml.etree.c:101889: note: expected ‘struct __pyx_obj_4lxml_5etree_TreeBuilder *’ but argument is of type ‘struct __pyx_obj_4lxml_5etree__SaxParserTarget *’
src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_11TreeBuilder_12comment’:
src/lxml/lxml.etree.c:102654: warning: passing argument 1 of ‘__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment’ from incompatible pointer type
src/lxml/lxml.etree.c:102015: note: expected ‘struct __pyx_obj_4lxml_5etree_TreeBuilder *’ but argument is of type ‘struct __pyx_obj_4lxml_5etree__SaxParserTarget *’
src/lxml/lxml.etree.c: In function ‘__pyx_f_4lxml_5etree__xslt_resolve_from_python’:
src/lxml/lxml.etree.c:137740: warning: enumeration value ‘__pyx_e_4lxml_5etree_PARSER_DATA_INVALID’ not handled in switch
src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_4XSLT_18__call__’:
src/lxml/lxml.etree.c:141814: warning: passing argument 1 of ‘__pyx_f_4lxml_5etree_12_XSLTContext__copy’ from incompatible pointer type
src/lxml/lxml.etree.c:139749: note: expected ‘struct __pyx_obj_4lxml_5etree__XSLTContext *’ but argument is of type ‘struct __pyx_obj_4lxml_5etree__BaseContext *’
src/lxml/lxml.etree.c: In function ‘__pyx_f_4lxml_5etree__copyXSLT’:
src/lxml/lxml.etree.c:143212: warning: passing argument 1 of ‘__pyx_f_4lxml_5etree_12_XSLTContext__copy’ from incompatible pointer type
src/lxml/lxml.etree.c:139749: note: expected ‘struct __pyx_obj_4lxml_5etree__XSLTContext *’ but argument is of type ‘struct __pyx_obj_4lxml_5etree__BaseContext *’
src/lxml/lxml.etree.c: At top level:
src/lxml/lxml.etree.c:12826: warning: ‘__pyx_f_4lxml_5etree_displayNode’ defined but not used
src/lxml/lxml.etree.c: In function ‘__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFile’:
src/lxml/lxml.etree.c:90304: warning: ‘__pyx_r’ may be used uninitialized in this function
src/lxml/lxml.etree.c: In function ‘__pyx_f_4lxml_5etree_11_BaseParser__parseUnicodeDoc’:
src/lxml/lxml.etree.c:89619: warning: ‘__pyx_r’ may be used uninitialized in this function
src/lxml/lxml.etree.c: In function ‘__pyx_f_4lxml_5etree_11_BaseParser__parseDoc’:
src/lxml/lxml.etree.c:89970: warning: ‘__pyx_r’ may be used uninitialized in this function
src/lxml/lxml.etree.c: In function ‘__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFilelike’:
src/lxml/lxml.etree.c:90623: warning: ‘__pyx_r’ may be used uninitialized in this function

所以输出只是挂起并且没有安装任何东西。

以下是有关机器的一些信息:
[root@ip-xx-xxx-xx-113 ec2-user]# cat /proc/version
Linux version 2.6.32-431.el6.x86_64 (mockbuild@c6b8.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) ) #1 SMP Fri Nov 22 03:15:09 UTC 2013

[root@ip-xx-xxx-xx-113 ec2-user]# cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m

[root@ip-xx-xxx-xx-113 ec2-user]# python --version
Python 2.6.6

最佳答案

先安装这些依赖

sudo yum install libxml2 libxml2-devel libxml2-python libxslt libxslt-devel

pip install lxml or easy_install lxml

建议使用 virtual environment .它有助于隔离 python 环境。

关于python - 无法在 CentOS 上安装 lxml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20886069/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com