Pip2 无法正常工作文件“/usr/bin/pip”,第 9 行,

Pip2 无法正常工作文件“/usr/bin/pip”,第 9 行,

我在使用 pip 时遇到了麻烦。我尝试删除并重新安装,但都不起作用。当我运行 pip 而不使用任何参数时,我收到以下错误:

Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip._internal import main
  File "/usr/lib/python2.7/dist-packages/pip/_internal/__init__.py", line 19, in <module>
    from pip._vendor.urllib3.exceptions import DependencyWarning
  File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 64, in <module>
    vendored("cachecontrol")
  File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
    __import__(modulename, globals(), locals(), level=0)
  File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/__init__.py", line 9, in <module>
  File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/wrapper.py", line 1, in <module>
  File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 4, in <module>
  File "/usr/share/python-wheels/requests-2.21.0-py2.py3-none-any.whl/requests/__init__.py", line 95, in <module>
  File "/usr/share/python-wheels/urllib3-1.24.1-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 46, in <module>
  File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 12, in <module>
    from cryptography import x509
  File "/usr/lib/python2.7/dist-packages/cryptography/x509/__init__.py", line 8, in <module>
    from cryptography.x509.base import (
  File "/usr/lib/python2.7/dist-packages/cryptography/x509/base.py", line 16, in <module>
    from cryptography.x509.extensions import Extension, ExtensionType
  File "/usr/lib/python2.7/dist-packages/cryptography/x509/extensions.py", line 24, in <module>
    from cryptography.x509.general_name import GeneralName, IPAddress, OtherName
  File "/usr/lib/python2.7/dist-packages/cryptography/x509/general_name.py", line 18, in <module>
    from cryptography.x509.name import Name
  File "/usr/lib/python2.7/dist-packages/cryptography/x509/name.py", line 28, in <module>
    _ASN1_TYPE_TO_ENUM = dict((i.value, i) for i in _ASN1Type)
TypeError: 'type' object is not iterable

答案1

尝试:

sudo apt-get 清除 python-pip sudo apt-get 安装 python-pip

重新安装后尝试“python -m pip install -U pip”

相关内容