为什么Pip在Ubuntu上无法正常工作?

时间:2018-09-01 02:04:32

标签: python ubuntu pip

我看了看又看不清这个问题。点子根本无法工作,这给我带来了很多麻烦。 pip3可以使用,但是pip完全不能使用。不断吐出与加密模块有关的错误。其他帖子说pip删除enum并pip安装enum34,但是问题是pip甚至不允许我这样做。当我尝试使用pip做任何事情时,都会吐出此错误或类似错误。

回溯(最近通话最近一次):

  File "/usr/local/bin/pip", line 11, in <module>
    load_entry_point('pip==18.1.dev0', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 480, 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 2693, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2324, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2330, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/__init__.py", line 40, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/cli/autocompletion.py", line 8, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/cli/main_parser.py", line 8, in <module>
    from pip._internal.cli import cmdoptions
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/cli/cmdoptions.py", line 17, in <module>
    from pip._internal.index import (
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/index.py", line 14, in <module>
    from pip._vendor import html5lib, requests, six
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_vendor/requests/__init__.py", line 97, in <module>
    from pip._vendor.urllib3.contrib import pyopenssl
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  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 个答案:

答案 0 :(得分:0)

尝试:

curl 'https://bootstrap.pypa.io/get-pip.py' -o get-pip.py
python get-pip.py --force-reinstall