【问题标题】:undefined symbol: xmlMemDisplayLast error with lxml未定义的符号: xmlMemDisplayLast 错误与 lxml
【发布时间】:2017-04-06 20:41:52
【问题描述】:

我在通过 pip 安装 lxml 时收到这些错误:

    running build_ext
    building 'lxml.etree' extension
    creating build/temp.linux-i686-3.5
    creating build/temp.linux-i686-3.5/src
    creating build/temp.linux-i686-3.5/src/lxml
    gcc -pthread -fno-strict-aliasing -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -Isrc/lxml/includes -I/usr/local/include/python3.5m -c src/lxml/lxml.etree.c -o build/temp.linux-i686-3.5/src/lxml/lxml.etree.o -w
    In file included from src/lxml/lxml.etree.c:321:
    src/lxml/includes/etree_defs.h:19:4: error: #error minimum required version of libxml2 is 2.7.0
    src/lxml/includes/etree_defs.h:28:4: error: #error minimum required version of libxslt is 1.1.23
    src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_9XMLParser___init__’:
    src/lxml/lxml.etree.c:113201: error: ‘XML_PARSE_HUGE’ undeclared (first use in this function)
    src/lxml/lxml.etree.c:113201: error: (Each undeclared identifier is reported only once
    src/lxml/lxml.etree.c:113201: error: for each function it appears in.)
    src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_10Schematron_6__call__’:
    src/lxml/lxml.etree.c:194047: error: ‘XML_SCHEMATRON_OUT_ERROR’ undeclared (first use in this function)
    Compile failed: command 'gcc' failed with exit status 1
    creating tmp
    cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitomumkupc.c -o tmp/xmlXPathInitomumkupc.o
    cc tmp/xmlXPathInitomumkupc.o -L/usr/lib -lxml2 -o a.out
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/local/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-2c9_3zz2/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-du99fdnt-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-2c9_3zz2/lxml/

假设某些软件包不符合要求,我尝试通过 yum 更新它们:

软件包 libxml2-2.6.26-2.1.25.el5_11.i386 已安装且最新版本

软件包 libxslt-1.1.17-4.el5_8.3.i386 已安装且最新版本

我在 CentOS 上使用 Python 3.5.1。没有直接的安装方法吗?

也许值得寻找另一个 yum 回购?

如果我尝试通过 https://serverfault.com/questions/266927/install-libxml2-2-7-x-on-centos-5-x#305682 这两个包的手动安装(libxslt 1.1.23 和 libxml 2-2.7.2)以使它们保持最新状态,则在尝试在 Python 中使用 lxml 时出现此错误3.5:

>>> from lxml import html
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/site-packages/lxml/html/__init__.py", line 54, in <module>
    from .. import etree
ImportError: /usr/local/lib/python3.5/site-packages/lxml/etree.cpython-35m-i386-linux-gnu.so: undefined symbol: xmlMemDisplayLast

【问题讨论】:

  • libxslt 怎么样?那是您应该安装的另一个库。
  • @schwobaseggl 是的,已经安装好了Package libxslt-1.1.17-4.el5_8.3.i386 already installed and latest version
  • 鉴于消息error minimum required version of libxml2 is 2.7.0error minimum required version of libxslt is 1.1.23,您是说您的问题是您不知道如何在CENTOS 上安装满足这些要求的软件包?这有帮助吗:serverfault.com/questions/266927/…?
  • @snakecharmerb 我尝试手动安装却遇到更多错误,我将其添加到问题中
  • 所以看起来 lxml 现在可以构建,但不知何故没有正确编译。您能告诉我们:您安装了哪些版本的 libxml2 和 libxslt?您安装了哪些版本的 libxml2-devel 和 libxslt-devel?你安装的是什么版本的lxml?

标签: python centos lxml


【解决方案1】:
src/lxml/includes/etree_defs.h:19:4: error: #error minimum required version of libxml2 is 2.7.0
src/lxml/includes/etree_defs.h:28:4: error: #error minimum required version of libxslt is 1.1.23

libxml2-devel & libxslt-devel 的版本不满足要求。

试试yum install libxml2-devel libxslt-devel

【讨论】:

  • 假设某些包不符合要求,我尝试通过 yum 更新它们,然后是太旧的包版本。他们需要帮助来寻找更新的软件包。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-06-19
  • 1970-01-01
  • 2013-02-01
  • 2012-10-10
  • 2013-10-22
  • 2014-06-01
  • 2015-11-13
相关资源
最近更新 更多