无法使用Scrapy dist-packages / cryptography / hazmat / bindings / _openssl.so启动项目

时间:2017-10-12 15:37:07

标签: python bash ubuntu scrapy

我是新手在unix和python中安装软件包。我正在Windows上使用Ubuntu上的Bash。 我想开始学习Scrapy,我使用它安装:

apt-get install scrapy

当我尝试创建项目时,我收到以下错误:

root > scrapy startproject tutorial
Traceback (most recent call last):
  File "/usr/local/bin/scrapy", line 11, in <module>
    sys.exit(execute())
  File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 128, in execute
    cmds = _get_commands_dict(settings, inproject)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 46, in _get_commands_dict
    cmds = _get_commands_from_module('scrapy.commands', inproject)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 29, in _get_commands_from_module
    for cmd in _iter_command_classes(module):
  File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 19, in _iter_command_classes
    for module in walk_modules(module_name):
  File "/usr/local/lib/python2.7/dist-packages/scrapy/utils/misc.py", line 71, in walk_modules
    submod = import_module(fullpath)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/commands/version.py", line 6, in <module>
    import OpenSSL
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 16, in <module>
    from OpenSSL._util import (
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 13, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /usr/local/lib/python2.7/dist-packages/cryptography/hazmat/bindings/_openssl.so: cannot enable executable stack as shared object requires: Invalid argument

我确认上述文件可用。我试图了解是否有任何我错过安装的先决条件(我怀疑,因为我知道他们在安装过程中处理 - 请纠正我,如果我错了),或者我需要什么启用。

谢谢,萨西

1 个答案:

答案 0 :(得分:0)

你不应该使用apt-get安装scrapy,因为它的版本很旧。你应该像下面这样做

apt install -y python python-pip

然后使用下面安装scrapy

pip install --force --upgrade scrapy