Scrapy startproject错误 - Python

时间:2016-10-22 19:01:46

标签: python macos python-2.7 module scrapy

在OSX 10.8,python 2.7.12,OpenSSL 0.9.8zg上,我安装了命令行工具然后使用" pip install scrapy"

安装scrapy

我尝试运行" scrapy startproject tutorial"它给了我这个错误:

Traceback (most recent call last):
  File "/Users/Jack/test_virtual_environment_for_python/bin/scrapy", line 11, in <module>
    sys.exit(execute())
  File "/Users/Jack/test_virtual_environment_for_python/lib/python2.7/site-packages/scrapy/cmdline.py", line 121, in execute
    cmds = _get_commands_dict(settings, inproject)
  File "/Users/Jack/test_virtual_environment_for_python/lib/python2.7/site-packages/scrapy/cmdline.py", line 45, in _get_commands_dict
    cmds = _get_commands_from_module('scrapy.commands', inproject)
  File "/Users/Jack/test_virtual_environment_for_python/lib/python2.7/site-packages/scrapy/cmdline.py", line 28, in _get_commands_from_module
    for cmd in _iter_command_classes(module):
  File "/Users/Jack/test_virtual_environment_for_python/lib/python2.7/site-packages/scrapy/cmdline.py", line 19, in _iter_command_classes
    for module in walk_modules(module_name):
  File "/Users/Jack/test_virtual_environment_for_python/lib/python2.7/site-packages/scrapy/utils/misc.py", line 71, in walk_modules
    submod = import_module(fullpath)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Users/Jack/test_virtual_environment_for_python/lib/python2.7/site-packages/scrapy/commands/version.py", line 6, in <module>
    import OpenSSL
  File "/Users/Jack/test_virtual_environment_for_python/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/Users/Jack/test_virtual_environment_for_python/lib/python2.7/site-packages/OpenSSL/rand.py", line 12, in <module>
    from OpenSSL._util import (
  File "/Users/Jack/test_virtual_environment_for_python/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/Users/Jack/test_virtual_environment_for_python/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: dynamic module does not define init function (init_openssl)

pip freeze:

attrs==16.2.0
cffi==1.8.3
cryptography==1.5.2
cssselect==1.0.0
enum34==1.1.6
idna==2.1
ipaddress==1.0.17
lxml==3.6.4
parsel==1.0.3
pyasn1==0.1.9
pyasn1-modules==0.0.8
pycparser==2.16
PyDispatcher==2.0.5
pyOpenSSL==16.2.0
queuelib==1.4.2
Scrapy==1.2.1
service-identity==16.0.0
six==1.10.0
Twisted==16.4.1
w3lib==1.15.0
zope.interface==4.3.2

1 个答案:

答案 0 :(得分:1)

似乎密码学(scrapy的依赖性)存在一些问题。您是否尝试过重新创建一个全新的虚拟环境?

还有一个关于加密文档的相当冗长的教程: https://cryptography.io/en/latest/installation/#building-cryptography-on-os-x