首页 > 代码库 > mac下使用scrapy时出现的raise DistributionNotFound(req)异常的处理方法

mac下使用scrapy时出现的raise DistributionNotFound(req)异常的处理方法

在os x下,安装完python爬虫框架scrapy后,使用scrapy startproject tutorial新建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 2603, in <module>    working_set.require(__requires__)  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require    needed = self.resolve(parse_requirements(requirements))  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve    raise DistributionNotFound(req)  # XXX put more info herepkg_resources.DistributionNotFound: queuelib

 

网上查了很久,终于找到解决方法(来自一位国际友人):

 

This is a problem in pkg_resources, and can be fixed by: sudo pip install --upgrade setuptools.It works fine with setuptools-5.3.

 

mac下使用scrapy时出现的raise DistributionNotFound(req)异常的处理方法