2016-03-07 57 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

我選擇了這個因爲它是第一個。但他們可能都工作 –

相關問題