我用sudo pip install scrapy
安装了scrapy。安装没有错误,但它不会运行。
scrapy --version
返回:
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 9, in <module>
load_entry_point('Scrapy==0.24.6', 'console_scripts', 'scrapy')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 521, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2632, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2312, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2318, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python3.4/dist-packages/scrapy/__init__.py", line 28, in <module>
import _monkeypatches
ImportError: No module named '_monkeypatches'
为什么要查看我的python 3目录?
答案 0 :(得分:0)
我找到了问题的解决方案:
我查看了/usr/local/lib/python2.7/dist-packages
和/usr/local/lib/python3.4/dist-packages
。每个人都有一个scrapy文件夹。我采取了以下步骤来解决:
sudo pip3 uninstall scrapy
sudo pip uninstall scrapy
sudo pip install scrapy
现在按预期工作。
编辑:再次感谢董事会成员提出的解决方案。