【问题标题】:Error building 'lxml.etree' extension构建“lxml.etree”扩展时出错
【发布时间】:2010-07-16 14:53:46
【问题描述】:

我正在尝试在运行 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。

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

【问题讨论】:

    标签: python ubuntu lxml


    【解决方案1】:

    “我已经通过 svn 签出”...

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

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

    【讨论】:

    • 打额头 - 感谢您提供的常识。通过 python setup.py install 从 tarball 安装的 lxml 2.2.6 工作正常。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-05-30
    • 1970-01-01
    • 2016-04-13
    • 2018-12-25
    • 2017-12-22
    • 2013-03-25
    • 1970-01-01
    相关资源
    最近更新 更多