mac os:pkg_resources.DistributionNotFound:lxml

时间:2015-11-29 10:49:49

标签: python macos

当我使用终端输入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 

然后我在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

但是当我再次进入scrapy时,结果仍然令人失望。

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

任何人甚至只是给我一个提示将不胜感激。 : - )

1 个答案:

答案 0 :(得分:0)

你有没有尝试过:

sudo apt-get install python-lxml

这通常对我有用