python - 搞砸了点子,得到“ImportError:找不到入口点('console_scripts','pip')”
问题描述
不知何故,我搞砸了我的 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
我发现一个 Stack Overflow 帖子说我应该使用以下命令重新安装 pip:python -m pip install --upgrade --force-reinstall pip但是当我这样做时,我得到:
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named pip
当然,尝试使用以下方法重新安装 python:brew install 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
我发现另一个 Stack Overflow 帖子说要使用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'
所以你可以看到我有点卡住了。我敢肯定,我错过了一些简单的事情,但我无法弄清楚它是什么。有谁知道我怎样才能让我的点子恢复和工作?在这一点上,如果可能的话,我可能也有兴趣安装我的 Python 2.7 并从头开始。提前致谢。
__米克
解决方案
推荐阅读
- excel - VBA 中的列表框选择未正确进行
- java - 主要 GC 未在 G1 中运行
- azure - 为已解决状态调用 Azure Monitor 警报
- javascript - 如何在短代码中使用 javascript 变量?
- git - 已恢复的精选提交的 Git rebase 可能会“丢失”它们
- javascript - 如何信任在互联网上找到的 javascript 开源库
- c++ - 使用角度向量的高效 3D 旋转
- angular - 如何在 Angular 中使用 formArray 修补 formGroup 中的值?
- javascript - 在解决 iOS 13 错误时检测何时启动 iOS Webclip
- google-maps - 如何在谷歌地图上的图像像素XY坐标上绘制标记