我想在ubunu为我的项目安装scrapy。我使用pip来安装scrapy但是我在安装时总是遇到这个错误。
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2361, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 22, in <module>
import requests, six
File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 53, in <module>
from .packages.urllib3.contrib import pyopenssl
File "/usr/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 53, in <module>
import OpenSSL.SSL
File "/home/karthick/.local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/home/karthick/.local/lib/python2.7/site-packages/OpenSSL/SSL.py", line 112, in <module>
if _lib.Cryptography_HAS_SSL_ST:
AttributeError: 'module' object has no attribute 'Cryptography_HAS_SSL_ST'
那么如何摆脱这个错误并安装scrapy
答案 0 :(得分:2)
这件事发生在我身上(尽管有Anaconda,而不是pip
)。
我追踪它将pyopenssl从16.0更新为16.2。
我的解决方案是首先重新安装Anaconda(将pyopenssl恢复到16.0)。 (您可能不需要这样做。)
之后,我跑了
sudo apt install python3-openssl
这样做之后,我的问题似乎得到纠正。
答案 1 :(得分:1)
我认为你应该先更新你的点子,然后再试一次。
我看到pip==1.5.6
,omg,它比月亮还年长