安装python-pip后出错

安装python-pip后出错

如果重要的话,我在 Windows 上安装了 Ubuntu(版本 18.04.4)。Python 版本是 2.7.17。

我正在使用以下方式安装 pip

sudo apt install python-pip

输出看起来不错,但是当我尝试通过以下方式检查 pip 的版本时

pip --version

我收到以下错误:

Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 22, in <module>
    from pip._vendor.requests.packages.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.18.4-py2.py3-none-any.whl/requests/__init__.py", line 84, in <module>
  File "/usr/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 46, in <module>
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 12, in <module>
    from cryptography import x509
  File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/__init__.py", line 8, in <module>
    from cryptography.x509.base import (
  File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/base.py", line 18, in <module>
    from cryptography.x509.extensions import Extension, ExtensionType
  File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/extensions.py", line 26, in <module>
    from cryptography.x509.general_name import GeneralName, IPAddress, OtherName
  File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/general_name.py", line 16, in <module>
    from cryptography.x509.name import Name
  File "/usr/local/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

请帮我解决问题

相关内容