简体   繁体   English

Mac OS:pkg_resources.DistributionNotFound:lxml

[英]mac os: pkg_resources.DistributionNotFound: lxml

when i input scrapy using terminal, the output is below: 当我使用终端输入scrapy时,输出如下:

Traceback (most recent call last):
  File "/usr/local/bin/scrapy", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2797, in <module>
    parse_requirements(__requires__), Environment()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 576, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: lxml 

then i searched some solutions around this problem in stackoverflow, then maybe i should run sudo easy_install --upgrade lxml and sudo easy_install --upgrade lxml , the result are below 然后我在stackoverflow中搜索了有关此问题的一些解决方案,然后也许我应该运行sudo easy_install --upgrade lxmlsudo easy_install --upgrade lxml ,结果如下

sudo easy_install --upgrade lxml
Searching for lxml
Reading https://pypi.python.org/simple/lxml/
Best match: lxml 3.5.0
Processing lxml-3.5.0-py2.7-macosx-10.6-intel.egg
lxml 3.5.0 is already the active version in easy-install.pth

Using /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml-3.5.0-py2.7-macosx-10.6-intel.egg
Processing dependencies for lxml
Finished processing dependencies for lxml

sudo easy_install --upgrade scrapy 
Password:
Searching for scrapy
Reading https://pypi.python.org/simple/scrapy/
Best match: Scrapy 1.0.3
Processing Scrapy-1.0.3-py2.7.egg
Scrapy 1.0.3 is already the active version in easy-install.pth
Installing scrapy script to /Library/Frameworks/Python.framework/Versions/2.7/bin

Using /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Scrapy-1.0.3-py2.7.egg
Processing dependencies for scrapy
Finished processing dependencies for scraps

But when i enter scrapy again, the result was still disappointed. 但是,当我再次进入混乱状态时,结果仍然令人失望。

scrapy
Traceback (most recent call last):
  File "/usr/local/bin/scrapy", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2797, in <module>
    parse_requirements(__requires__), Environment()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 576, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: lxml

Anyone even just give me a hint would be appreciated. 任何人甚至只是给我一个提示都将不胜感激。 :-) :-)

Did you try: 你试过了吗:

sudo apt-get install python-lxml

This is what usually works for me 这通常对我有用

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

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