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

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

Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in 
    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_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
    return 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 
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in 
    from pip.download import path_to_url
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 22, in 
    import requests, six
  File "/usr/local/lib/python2.7/dist-packages/requests-2.4.3-py2.7.egg/requests/__init__.py", line 53, in 
    from .packages.urllib3.contrib import pyopenssl
  File "/usr/local/lib/python2.7/dist-packages/requests-2.4.3-py2.7.egg/requests/packages/urllib3/contrib/pyopenssl.py", line 73, in 
    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 安装了

你可能感兴趣的:(Linux,Python,Debian系统维护使用.)