Setup.py:在CentOS上使用Python2.6安装lxml [英] Setup.py: install lxml with Python2.6 on CentOS

查看:94
本文介绍了Setup.py:在CentOS上使用Python2.6安装lxml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在CentOS 5.4上安装了Python 2.6.6,

I have installed Python 2.6.6 on CentOS 5.4,

[@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模块,但是从源代码构建失败:

I want to use the lxml module, but build from sources failed:

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-develpython-devel之后设法安装了它,这似乎是您的问题:

I had the same issue, I managed to install it after installing the package libxslt-devel and python-devel which seems to be your problem:

yum install libxslt-devel python-devel

python setup.py install

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

但是,由于我也在此过程中安装了其他软件包,因此您可能想在使用它时再次检查libxml2libxml2-devellibxslt.

However since I also installed other packages in the process, you might want to double check libxml2, libxml2-devel and libxslt while you are at it.

以下是有关如何构建lxml的一些信息: http://lxml.de/build.html

Here is some information on how to build lxml: http://lxml.de/build.html

这篇关于Setup.py:在CentOS上使用Python2.6安装lxml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆