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

发布于 2024-10-11 01:07:18 字数 826 浏览 4 评论 0原文

我已经在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

黯淡〆 2024-10-18 01:07:18

我遇到了同样的问题,我在安装包 libxslt-develpython-devel 后成功安装了它,这似乎是您的问题:

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 当你在做的时候。

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

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

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.

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

风情万种。 2024-10-18 01:07:18

它解决了我在 Centos 中的 nokogiri 问题

sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel

It solved my problem for nokogiri in Centos

sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
暮凉 2024-10-18 01:07:18

这些对我有用,

yum -y install python-devel gcc libxml2 libxml2-devel libxslt libxslt-devel

尤其是 python-devel

these works for me

yum -y install python-devel gcc libxml2 libxml2-devel libxslt libxslt-devel

especially the python-devel

羁〃客ぐ 2024-10-18 01:07:18

如果以下方法不起作用,

sudo yum install libxslt-devel python-devel

请尝试此操作

pip install -U pip setuptools

,然后通过以下方式安装

pip install lxml

If the below doesn't work

sudo yum install libxslt-devel python-devel

try this

pip install -U pip setuptools

and then install by

pip install lxml
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文