#python #macos #python-2.7 #module #scrapy
#python #macos #python-2.7 #модуль #scrapy
Вопрос:
В OSX 10.8, python 2.7.12, OpenSSL 0.9.8zg я установил инструменты командной строки, а затем установил scrapy с помощью «pip install scrapy».
Я пытаюсь запустить «учебное пособие по scrapy startproject», и оно выдает мне эту ошибку:
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 зависает:
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:
Похоже, что у криптографии (зависящей от scrapy) возникают некоторые проблемы. Вы пробовали просто воссоздать новую виртуальную среду?
Также есть довольно длинное руководство по документам по криптографии:https://cryptography.io/en/latest/installation/#building-cryptography-on-os-x