setup.py:在CentOS上使用Python2.6安装lxml
我已经在 CentOS 5.4 上安装了 Python 2.6.6,
[@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
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.
>>>
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我遇到了同样的问题,我在安装包
libxslt-devel
和python-devel
后成功安装了它,这似乎是您的问题:yum install libxslt- devel python-devel
python setup.py install
但是,由于我在此过程中还安装了其他软件包,因此您可能需要仔细检查
libxml2
、libxml2 -devel
和libxslt
当你在做的时候。以下是有关如何构建 lxml 的一些信息:http://lxml.de/build.html
I had the same issue, I managed to install it after installing the package
libxslt-devel
andpython-devel
which seems to be your problem:yum install libxslt-devel python-devel
python setup.py install
However since I also installed other packages in the process, you might want to double check
libxml2
,libxml2-devel
andlibxslt
while you are at it.Here is some information on how to build lxml: http://lxml.de/build.html
它解决了我在 Centos 中的 nokogiri 问题
It solved my problem for nokogiri in Centos
这些对我有用,
尤其是
python-devel
these works for me
especially the
python-devel
如果以下方法不起作用,
请尝试此操作
,然后通过以下方式安装
If the below doesn't work
try this
and then install by