Python3.5安装Scrapy遇到的错误及解决方法

Posted Calm微笑

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python3.5安装Scrapy遇到的错误及解决方法相关的知识,希望对你有一定的参考价值。

安装步骤详见官方网址http://doc.scrapy.org/en/latest/intro/install.html

 

一 、sudo pip3 install Scrapy出现错误

pyasn1-modules 0.2.4 has requirement pyasn1<0.5.0,>=0.4.1, but you'll have pyasn1 0.1.9 which is incompatible.
pyopenssl 19.0.0 has requirement cryptography>=2.3, but you'll have cryptography 1.2.3 which is incompatible.

pyasn1-modules版本过低

解决方法 sudo  pip3 install pyasn1-modules

二、pip3 install pyasn1-modules 出现错误

Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 7, in <module>
    from pip._internal import main
  File "/usr/local/lib/python3.5/dist-packages/pip/_internal/__init__.py", line 40, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/main_parser.py", line 12, in <module>
    from pip._internal.commands import (
  File "/usr/local/lib/python3.5/dist-packages/pip/_internal/commands/__init__.py", line 6, in <module>
    from pip._internal.commands.completion import CompletionCommand
  File "/usr/local/lib/python3.5/dist-packages/pip/_internal/commands/completion.py", line 6, in <module>
    from pip._internal.cli.base_command import Command
  File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/base_command.py", line 20, in <module>
    from pip._internal.download import PipSession
  File "/usr/local/lib/python3.5/dist-packages/pip/_internal/download.py", line 15, in <module>
    from pip._vendor import requests, six, urllib3
  File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/requests/__init__.py", line 97, in <module>
    from pip._vendor.urllib3.contrib import pyopenssl
  File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/usr/local/lib/python3.5/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/local/lib/python3.5/dist-packages/OpenSSL/SSL.py", line 194, in <module>
    if _lib.Cryptography_HAS_SSL_ST:
AttributeError: module 'lib' has no attribute 'Cryptography_HAS_SSL_ST'

解决方法:重新安装OpenSSL

sudo rm -rf /usr/local/lib/python3.5/dist-packages/OpenSSL/

sudo apt install --reinstall python-openssl

 

以上是关于Python3.5安装Scrapy遇到的错误及解决方法的主要内容,如果未能解决你的问题,请参考以下文章

02scrapy安装

python3.5 之Scrapy环境安装

Python3.5下安装&测试Scrapy

安装scrapy框架出错的解决

python3下scrapy爬虫(第一卷:安装问题)

Python scrapy 常见问题及解决 遇到的坑