当前位置: 代码迷 >> 综合 >> Debian (Jessie 8.0) 的修复pip AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'
  详细解决方案

Debian (Jessie 8.0) 的修复pip AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'

热度:36   发布时间:2023-12-08 03:04:10.0

升级到最新的stable后,python的pip还是老的. 在安装一些包的时候,报错了

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.py", line 356, in load_entry_pointreturn get_distribution(dist).load_entry_point(group, name)File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_pointreturn ep.load()File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load['__name__'])File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module>from pip.vcs import git, mercurial, subversion, bazaar  # noqaFile "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>from pip.download import path_to_urlFile "/usr/lib/python2.7/dist-packages/pip/download.py", line 22, in <module>import requests, sixFile "/usr/local/lib/python2.7/dist-packages/requests-2.4.3-py2.7.egg/requests/__init__.py", line 53, in <module>from .packages.urllib3.contrib import pyopensslFile "/usr/local/lib/python2.7/dist-packages/requests-2.4.3-py2.7.egg/requests/packages/urllib3/contrib/pyopenssl.py", line 73, in <module>ssl.PROTOCOL_SSLv3: OpenSSL.SSL.SSLv3_METHOD,
AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'

原因是debian8的pip用了urllib3, 而urllib3使用了debian8的新编译的OpenSSL SSLv3版. 


修复很简单, 升级pip,

pip install requests==2.6.0

或者

easy_install --upgrade pip
然后就可以pip install 安装了

  相关解决方案