问题
I am trying to import 'lxml' library into my python program as follows.
from lxml import etree
However, I am getting an error as 'undefined symbol: PyFPE_jbuf'. Here is the entire stack trace
File "xmlExtract.py", line 4, in <module>
from lxml import etree
ImportError: /usr/local/lib/python3.4/dist-packages/lxml/etree.cpython-34m.so: undefined symbol: PyFPE_jbuf
I have carefully installed 'lxml' library including all of its dependencies (libxml2-dev, libxslt-dev, python-dev). I also have older version of python i.e 2.7 along with the new one python3.4. I tried setting variable PYTHONPATH=/usr/local/lib/python3.4/dist-packages but still encountering the above error.
Could someone please help to resolve my issue.
回答1:
I had this same issue, and was able to get past it reinstalling lxml with:
pip install lxml --no-use-wheel
Depending on your version of pip, you may also use:
pip install lxml --no-binary :all:
回答2:
I've just come across this on one of my systems. On my system this comes from switching from system Python to a custom one but keeping the wheels around.
To fix this:
pip uninstall lxml
cd
find .cache -name 'lxml*cp34*.whl' # check there is a wheel
find .cache -name 'lxml*cp34*.whl' -delete # remove it
pip install lxml
Thanks to @moo-_- for solving this in another context. See https://stackoverflow.com/a/6893563/2385133 for further details.
来源:https://stackoverflow.com/questions/35852646/undefined-symbol-pyfpe-jbuf-error-while-using-lxml-on-ubuntu