无法在我的Mac上安装scrapy

时间:2017-02-26 11:46:23

标签: python scrapy

我曾尝试在我的mac上安装scrapy(10.12.3)但失败了。事实上,我可以在pycharm中导入scrapy并且没有错误,但是,当我尝试在我的终端中使用时,发生了错误。

loohazeMacBook-Pro:~ loohaze$ scrapy
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/bin/scrapy", line 11, in <module>
    load_entry_point('Scrapy==1.3.2', 'console_scripts', 'scrapy')()
  File "/Users/loohaze/Library/Python/2.7/lib/python/site-packages/scrapy/cmdline.py", line 121, in execute
    cmds = _get_commands_dict(settings, inproject)
  File "/Users/loohaze/Library/Python/2.7/lib/python/site-packages/scrapy/cmdline.py", line 45, in _get_commands_dict
    cmds = _get_commands_from_module('scrapy.commands', inproject)
  File "/Users/loohaze/Library/Python/2.7/lib/python/site-packages/scrapy/cmdline.py", line 28, in _get_commands_from_module
    for cmd in _iter_command_classes(module):
  File "/Users/loohaze/Library/Python/2.7/lib/python/site-packages/scrapy/cmdline.py", line 19, in _iter_command_classes
    for module in walk_modules(module_name):
  File "/Users/loohaze/Library/Python/2.7/lib/python/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/loohaze/Library/Python/2.7/lib/python/site-packages/scrapy/commands/version.py", line 6, in <module>
    import OpenSSL
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/rand.py", line 12, in <module>
    from OpenSSL._util import (
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/Library/Frameworks/Python.framework/Versions/2.7/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)

我是python的新手,请帮忙!感谢

1 个答案:

答案 0 :(得分:0)

尝试做:     xcode-select --install

scrapy安装指南中存在已知问题 - https://doc.scrapy.org/en/latest/intro/install.html