Setup.py:在CentOS上使用Python2.6安装lxml

前端之家收集整理的这篇文章主要介绍了Setup.py:在CentOS上使用Python2.6安装lxml前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在CentOS 5.4上安装了Python 2.6.6,
[siyuan.tong@SC-055 lxml-2.3beta1]$ python
Python 2.6.6 (r266:84292,Jan  4 2011,09:49:55) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help","copyright","credits" or "license" for more information.
>>>

我想使用lxml模块,但从源代码构建失败:

src/lxml/lxml.etree.c:157929: error: ‘xsltLibxsltVersion’ undeclared (first use in this function)
src/lxml/lxml.etree.c:157941: error: ‘__pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER’ undeclared (first use in this function)
src/lxml/lxml.etree.c:157941: error: ‘xsltDocDefaultLoader’ undeclared (first use in this function)
src/lxml/lxml.etree.c:157950: error: ‘__pyx_f_4lxml_5etree__xslt_doc_loader’ undeclared (first use in this function)
error: command 'gcc' Failed with exit status 1
我有同样的问题,我管理安装软件包libxslt-devel和python-devel似乎是你的问题后安装它:

yum install libxslt-devel python-devel

python setup.py安装

Installed /usr/lib/python2.6/site-packages/lxml-2.2.8-py2.6-linux-i686.egg
Processing dependencies for lxml==2.2.8
Finished processing dependencies for lxml==2.2.8

但是,由于我也安装了其他软件包在进程中,你可能要双重检查libxml2,libxml2-devel和libxslt,而你在它。

这里是一些关于如何建立lxml:http://lxml.de/build.html的信息

原文链接:https://www.f2er.com/centos/375391.html

猜你在找的CentOS相关文章