问题描述
我有一个令人困惑的问题.我用过 mac 10.9 版,anaconda 3.4.1,python 2.7.6.
I have a perplexing problem.I have used mac version 10.9, anaconda 3.4.1, python 2.7.6.
使用 python-amazon-product-api 开发 Web 应用程序.我已经克服了关于安装 lxml 的障碍,参考 clang 错误:未知参数:'-mno-fused-madd'(python 包安装失败).
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!
推荐答案
我遇到了同样的问题.我意识到在为我的 Web 应用程序安装 pip 期间,lxml 正在尝试以下操作:
I was having this same issue. I realized that during pip install for my web app, lxml was attempting the following:
在以下目录中针对 libxml2/libxslt 进行构建:/Users/[me]/anaconda/lib"
"Building against libxml2/libxslt in the following directory: /Users/[me]/anaconda/lib"
不是 100% 确定为什么,但是一旦我从 bash_profile 的系统路径中删除了 anaconda/bin(安装时 anaconda 将它粘在那里),我就能够正确 pip install lxml.之后,您应该可以毫无问题地将 anaconda/bin 重新添加到系统路径中.
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.
这篇关于lxml 运行时错误:原因:库版本不兼容:etree.so 需要版本 12.0.0 或更高版本,但 libxml2.2.dylib 提供版本 10.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!