【问题标题】:Why can't I install lxml for python?为什么我不能为 python 安装 lxml?
【发布时间】:2014-11-12 10:20:52
【问题描述】:

我已经下载了 lxml 的压缩包,并且正在使用 ipython setup.py install 来尝试安装它。不幸的是,它给了我一屏错误信息:

src/lxml/lxml.etree.c:200651: error: ‘XML_XPATH_INVALID_OPERAND’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200661: error: ‘XML_XPATH_INVALID_TYPE’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200671: error: ‘XML_XPATH_INVALID_ARITY’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200681: error: ‘XML_XPATH_INVALID_CTXT_SIZE’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200691: error: ‘XML_XPATH_INVALID_CTXT_POSITION’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200921: error: ‘LIBXSLT_VERSION’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200933: error: ‘xsltLibxsltVersion’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200945: error: ‘__pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200945: error: ‘xsltDocDefaultLoader’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200954: error: ‘xsltDocLoaderFunc’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200954: error: expected ‘)’ before ‘__pyx_f_4lxml_5etree__xslt_doc_loader’
An exception has occurred, use %tb to see the full traceback.

SystemExit: error: command 'gcc' failed with exit status 1

有人知道这里发生了什么吗?显然 cython 会干扰安装,但我的系统上没有安装 cython。这是在 centos 6.4 操作系统上,ipython 运行 2.7。

【问题讨论】:

  • 你有python头开发安装吗?

标签: python lxml


【解决方案1】:

lxml 依赖于libxml2libxslt。使用 yum 安装开发头文件:

yum install libxml2-devel libxslt-devel python-devel

【讨论】:

    猜你喜欢
    • 2023-01-27
    • 1970-01-01
    • 2018-05-14
    • 2021-02-26
    • 2018-02-27
    • 2016-10-11
    • 1970-01-01
    • 1970-01-01
    • 2010-09-30
    相关资源
    最近更新 更多