lxml runtime error: Reason: Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0

匿名 (未验证) 提交于 2019-12-03 02:47:02

问题:

I have a perplexing problem. I have used mac version 10.9, anaconda 3.4.1, python 2.7.6.

Developing web application with python-amazon-product-api. i have overcome an obstacle about installing lxml, referencing clang error: unknown argument: '-mno-fused-madd' (python package installation failure).

but another runtime error happened. Here is the output from webbrowser.

Exception Type: ImportError Exception Value:     dlopen(/Users/User_Name/Documents/App_Name/lib/python2.7/site-packages/lxml/etree.so, 2): Library not loaded: libxml2.2.dylib Referenced from: /Users/User_Name/Documents/App_Name/lib/python2.7/site-packages/lxml/etree.so Reason: Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0

Not sure how to proceed and have searched here and elsewhere for this particular error. Any help is much appreciated!

回答1:

I was having this same issue. I realized that during pip install for my web app, lxml was attempting the following:

"Building against libxml2/libxslt in the following directory: /Users/[me]/anaconda/lib"

Not 100% sure why, but once I removed the anaconda/bin from my system path in bash_profile (anaconda sticks it in there when installing) I was able to pip install lxml correctly. After which you should be able to re-add anaconda/bin to your system path without issue.



回答2:

This worked for me:

brew install libxml2 brew install libxslt brew link libxml2 --force brew link libxslt --force


回答3:

If using conda, force a reinstall of lxml:

$ conda install -f lxml

Note that forcing a reinstall may have unforeseen consequences.

I first tried conda update lxml to no effect.

Then tried conda install lxml also to no effect (but that was a while ago and ymmv -- see comment).



回答4:

I get this to work by doing the following:

conda install libxml2


回答5:

Consider using an alternative channel in conda.

$ anaconda search -t conda pyquery Using anaconda-server api site https://api.anaconda.org Run 'anaconda show ' to get more details: Packages:      Name                      |  Version | Package Types   | Platforms            ------------------------- |   ------ | --------------- | ---------------      CS109/pyquery             |    1.2.9 | conda           | linux-64, win-32, win-64, linux-32, osx-64                                           : A jquery-like library for python      asmeurer/pyquery          |    1.2.6 | conda           | osx-64                                                    : https://github.com/gawel/pyquery      auto/pyquery              |    1.2.8 | conda           | linux-64, linux-32, osx-64                                           : https://github.com/gawel/pyquery      dan_blanchard/pyquery     |    1.2.6 | conda           | linux-64                                                  : https://github.com/gawel/pyquery      hargup/pyquery            |          | conda           | None-None, linux-64                                           : A jquery-like library for python      meloncholy/pyquery        |    1.2.9 | conda           | linux-64                                                  : A jquery-like library for python      mhworth/pyquery           |    1.2.8 | conda           | linux-64, osx-64                                           : A jquery-like library for python      nbsantos/pyquery          |    1.2.9 | conda           | osx-64                                                    : A jquery-like library for python      pdrops/pyquery            |    1.2.8 | conda           | linux-64, osx-64                                           : A jquery-like library for python      ziebel/pyquery            |    1.2.9 | conda           | linux-64                                                  : A jquery-like library for python Found 10 packages

Then, picking a channel, do:

conda install pyquery -c CS109


回答6:

I tried almost all approaches above and failed. What worked for me was commenting out the

export DYLD_LIBRARY_PATH=/usr/lib

in my bash profile. This line is added by the anaconda installer automatically.



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