“undefined symbol: __xmlStructuredErrorContext” importing etree from lxml

允我心安 提交于 2019-12-12 12:28:46

问题


>>> import lxml
>>> from lxml import etree
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /usr/local/lib/python3.4/site-packages/lxml/etree.cpython-34m.so: undefined symbol: __xmlStructuredErrorContext

i do have libxml2 and libxslt, i have tried uninstalling and reinstalling too, it didn't help. lxml version: 3.4.4, python: 3.4.2, OS: RHEL 5.5 Please help resolve this issue

Thanks


回答1:


Your version of lxml.etree was compiled against a different version of libxml2 than the one you have actually installed. Reinstalling libxml2 doesn't help because you're just reinstalling the same code. Reinstalling the binaries that bundle your existing etree.cpython-34m.so binary won't work either, because that binary itself is inherently broken (it refers to a symbol that isn't exported in all versions of libxml2).

Uninstall the Python module -- not the C library -- and reinstall it from source. (pip should be able to do this automatically, assuming that you have -devel headers for libxml2 and libxslt installed and an appropriate compiler).



来源:https://stackoverflow.com/questions/33089381/undefined-symbol-xmlstructurederrorcontext-importing-etree-from-lxml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!