构建'lxml.etree'扩展时出错

时间:2010-07-16 14:53:46

标签: python ubuntu lxml

我正在尝试在运行Python 2.6的Ubuntu服务器上安装lxml(在virtualenv中 - 系统Python是2.5)。

我已经通过svn检出了,因此我也安装了Cython,as per the instructions

但是,运行python setup.py build时出现以下错误:

Building lxml version 2.3.alpha1-76211.
Building with Cython 0.11.
Using build configuration of libxslt 1.1.22
Building against libxml2/libxslt in the following directory: /usr/lib
running build
running build_py
running build_ext
cythoning src/lxml/lxml.etree.pyx to src/lxml/lxml.etree.c

Error converting Pyrex file to C:
------------------------------------------------------------
...
        c_child = _findChildForwards(c_node, 0)
        while c_child is not NULL:
            if c_child.type == tree.XML_ELEMENT_NODE:
                for i in range(c_tag_count):
                    if _tagMatchesExactly(c_child, c_ns_tags[2*i], c_ns_tags[2*i+1]):
                        c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
                                                               ^
------------------------------------------------------------

/home/admin/web/blink/lxml/src/lxml/cleanup.pxi:246:64: Cannot assign type 'int' to 'xmlNode *'

Error converting Pyrex file to C:


building 'lxml.etree' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/home/admin/python/2.6.5/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.6/src/lxml/lxml.etree.o -w
src/lxml/lxml.etree.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
error: command 'gcc' failed with exit status 1

如果我尝试python setup.py bdist_eggpython setup.py build_ext -imake

,则会出现非常相似的错误

尝试通过easy_install或pip进行安装会产生相同的错误 - 尽管前者只是无限期挂起。

据我所知,安装了所有各种依赖项,例如python-dev。

我错过了什么/做错了什么?

1 个答案:

答案 0 :(得分:1)

“我通过 svn ”检查了...

“构建lxml版本2.3。 alpha1 -76211”...

你似乎处于最前沿。建议:使用lxml源的已发布版本。咨询lxml作者/维护者。