新人一枚,费尽千辛万苦终于在win7下把scrapy安装好,按照文档写出了第一只spider,但运行时还是报错了
我安装的OpenSSL是"egenix-pyopenssl-0.13.3.1.0.1.6.win-amd64-py2.7.msi",在python下import无碍,scrapy也可以在cmd中正常启动和创建项目了。
下面是错误提示,求高手指教:
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\lib\site-packages\scrapy-0.22.2-py2.7.egg\scrapy\cmdline.py", line 168, in <module>
execute()
File "C:\Python27\lib\site-packages\scrapy-0.22.2-py2.7.egg\scrapy\cmdline.py", line 122, in execute
cmds = _get_commands_dict(settings, inproject)
File "C:\Python27\lib\site-packages\scrapy-0.22.2-py2.7.egg\scrapy\cmdline.py", line 46, in _get_commands_dict
cmds = _get_commands_from_module('scrapy.commands', inproject)
File "C:\Python27\lib\site-packages\scrapy-0.22.2-py2.7.egg\scrapy\cmdline.py", line 29, in _get_commands_from_module
for cmd in _iter_command_classes(module):
File "C:\Python27\lib\site-packages\scrapy-0.22.2-py2.7.egg\scrapy\cmdline.py", line 20, in _iter_command_classes
for module in walk_modules(module_name):
File "C:\Python27\lib\site-packages\scrapy-0.22.2-py2.7.egg\scrapy\utils\misc.py", line 68, in walk_modules
submod = import_module(fullpath)
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\scrapy-0.22.2-py2.7.egg\scrapy\commands\bench.py", line 3, in <module>
from scrapy.tests.mockserver import MockServer
File "C:\Python27\lib\site-packages\scrapy-0.22.2-py2.7.egg\scrapy\tests\mockserver.py", line 6, in <module>
from twisted.internet import reactor, defer, ssl
File "C:\Python27\lib\site-packages\twisted\internet\ssl.py", line 25, in <module>
from OpenSSL import SSL
File "build\bdist.win-amd64\egg\OpenSSL\__init__.py", line 8, in <module>
File "build\bdist.win-amd64\egg\OpenSSL\rand.py", line 11, in <module>
File "build\bdist.win-amd64\egg\OpenSSL\_util.py", line 3, in <module>
ImportError: No module named cryptography.hazmat.bindings.openssl.binding
错误提示比较明显,缺失cryptography模块 解决方法:pip install cryptography 如果你是pycharm可以setting——>Project:XXXXX——>project Interpreter中右上角点击+号输入cryptography添加
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。