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 
    from pip._internal import main
  File "/usr/local/lib/python3.5/dist-packages/pip/_internal/__init__.py", line 40, in 
    from pip._internal.cli.autocompletion import autocomplete
  File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/autocompletion.py", line 8, in 
    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 
    from pip._internal.commands import (
  File "/usr/local/lib/python3.5/dist-packages/pip/_internal/commands/__init__.py", line 6, in 
    from pip._internal.commands.completion import CompletionCommand
  File "/usr/local/lib/python3.5/dist-packages/pip/_internal/commands/completion.py", line 6, in 
    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 
    from pip._internal.download import PipSession
  File "/usr/local/lib/python3.5/dist-packages/pip/_internal/download.py", line 15, in 
    from pip._vendor import requests, six, urllib3
  File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/requests/__init__.py", line 97, in 
    from pip._vendor.urllib3.contrib import pyopenssl
  File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in 
    import OpenSSL.SSL
  File "/usr/local/lib/python3.5/dist-packages/OpenSSL/__init__.py", line 8, in 
    from OpenSSL import crypto, SSL
  File "/usr/local/lib/python3.5/dist-packages/OpenSSL/SSL.py", line 194, in 
    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

 

你可能感兴趣的:(Python,爬虫)