简体   繁体   English

导入错误 - (Python 2.7)

[英]Import Error - (Python 2.7)

I've been trying to solve an import error I've been getting the whole day and it's just driving me crazy. 我一直试图解决导入错误,我一整天都在这里,这只会让我发疯。 I've literally went through every Stack Overflow similar question and tried out every single solution and nothing seems to do the magic for me. 我真的经历了每个Stack Overflow类似的问题,并尝试了每一个解决方案,似乎没有任何东西可以为我做神奇。

I'm currently running a script on my Terminal by doing 我正在我的终端上运行一个脚本

$ python camelcamelcamel-import.py

The error I'm getting is: 我得到的错误是:

 Traceback (most recent call last):
 File "camelcamelcamel-import.py", line 1, in <module>
 import sys, mechanize, lxml.html
 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml/html/init.py", line 54, in <module>
 from .. import etree
 ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml/etree.so, 2): Symbol not found: _xsltDocDefaultLoader
 Referenced from:        /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml/etree.so
 Expected in: dynamic lookup

I've tried installing/uninstall the modules, the same thing for pip and nothing seems to work for me. 我已经尝试安装/卸载模块,对于pip来说同样的事情,似乎没有什么对我有用。

Any help would be extremely appreciated, thank you! 非常感谢任何帮助,谢谢!

Reinstall libxslt and libxml2 using brew. 使用brew重新安装libxslt和libxml2。

brew install libxslt libxml2

If you see errors during install, execute this: 如果在安装期间看到错误,请执行以下命令:

xcode-select --install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM