问题
>>> 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