搞砸了pip,找不到“ImportError:入口点('console_scripts','pip')”

2024-10-02 18:28:04 发布

您现在位置:Python中文网/ 问答频道 /正文

不知怎的,我把我的pip安装搞砸了。我无法使用pip安装任何东西,甚至无法获取版本。当我尝试获取版本时,出现以下错误:

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 8, in <module>
    load_entry_point('pip==1.3.1', 'console_scripts', 'pip')()
  File "/Library/Python/2.7/site-packages/pkg_resources.py", line 343, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/Library/Python/2.7/site-packages/pkg_resources.py", line 2353, in load_entry_point
    raise ImportError("Entry point %r not found" % ((group,name),))
ImportError: Entry point ('console_scripts', 'pip') not found

我发现了一篇堆栈溢出帖子,上面说我应该使用:python-mpipinstall--upgrade--force重新安装pip重新安装pip,但当我这样做时,我得到了:

/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named pip

当然,尝试使用:brew安装python重新安装python会让我:

==> Installing dependencies for python: readline, sqlite, gdbm, makedepend, openssl
==> Installing python dependency: readline
==> Downloading http://ftpmirror.gnu.org/readline/readline-6.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/readline-6.3.8.tar.gz
==> Downloading https://gist.githubusercontent.com/jacknagel/d886531fb6623b60b2af/raw/746fc543e56bc37a26ccf05d2946a45176b0894e/readline-6.3.8.diff
##O=#    #                                                                                                                                           
curl: (22) The requested URL returned error: 404 Not Found
Error: Failed to download resource "readline--patch"
Download failed: https://gist.githubusercontent.com/jacknagel/d886531fb6623b60b2af/raw/746fc543e56bc37a26ccf05d2946a45176b0894e/readline-6.3.8.diff

我发现另一个堆栈溢出帖子说要使用get-pip.py文件,但是这样做了 抛出以下命令:

Traceback (most recent call last):
  File "get-pip.py", line 23484, in <module>
    main()
  File "get-pip.py", line 198, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 83, in bootstrap
    from pip._internal.commands.install import InstallCommand
  File "/tmp/tmpH6zFs7/pip.zip/pip/_internal/commands/install.py", line 24, in <module>
  File "/tmp/tmpH6zFs7/pip.zip/pip/_internal/cli/req_command.py", line 16, in <module>
  File "/tmp/tmpH6zFs7/pip.zip/pip/_internal/index/package_finder.py", line 21, in <module>
  File "/tmp/tmpH6zFs7/pip.zip/pip/_internal/index/collector.py", line 14, in <module>
  File "/tmp/tmpH6zFs7/pip.zip/pip/_vendor/requests/__init__.py", line 97, in <module>
  File "/tmp/tmpH6zFs7/pip.zip/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL/crypto.py", line 12, in <module>
    from cryptography import x509
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/x509/__init__.py", line 7, in <module>
    from cryptography.x509 import certificate_transparency
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/x509/certificate_transparency.py", line 22, in <module>
    @six.add_metaclass(abc.ABCMeta)
AttributeError: 'module' object has no attribute 'add_metaclass'

正如你所看到的,我有点卡住了。我确信我遗漏了一些简单的东西,但我不知道它是什么。有人知道我怎样才能找回我的皮普吗;工作在这一点上,我可能还对我的Python2.7安装感兴趣&;如果可能的话,从头开始。提前谢谢

米克


Tags: pipinpyreadlinegetlinelibraryzip