2016-03-07 30 views
3

我想按如下方式将'lxml'库导入到我的python程序中。未定义的符号:在ubuntu上使用'lxml'时出现PyFPE_jbuf错误

from lxml import etree 

但是,我收到一个错误,因为'未定义符号:PyFPE_jbuf'。这里是整个堆栈跟踪

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 

我仔细安装 'LXML' 库,包括其所有相关性(的libxml2-dev的,的libxslt-dev的,蟒蛇-DEV)。我也有Python的老版本,即2.7和新的python3.4。 我试着设置变量PYTHONPATH =/usr/local/lib/python3.4/dist-packages 但仍然遇到上述错误。

有人可以帮助解决我的问题。

回答

3

我有同样的问题,而且是能够超越它重新安装LXML有:

pip install lxml --no-use-wheel 

根据您的PIP的版本,你也可以使用:

pip install lxml --no-binary :all: 
1

我已经只是在我的一个系统上遇到这个问题。在我的系统上,这来自于从系统Python切换到自定义系统,但保持轮子周围。

要解决这个问题:

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 

感谢@moo -_-在另一个方面解决这一点。进一步的细节见https://stackoverflow.com/a/6893563/2385133

+0

我选择了这个因为它是第一个。但他们可能都工作 –