所以我对我的python安装感到沮丧,因为它没有正确安装virtualenv和virtualenvwrapper,并试图卸载所有内容以尝试重新开始,但现在pip坏了,我得到这些错误:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 11, in <module>
load_entry_point('pip==21.0.1', 'console_scripts', 'pip')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2843, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2434, in load
return self.resolve()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Library/Python/2.7/site-packages/pip-21.0.1-py2.7.egg/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
是否有办法手动重新安装pip ?网站上的安装方法不起作用。谢谢!
如果你想要Pip for Python 2
似乎你有pip 21.0.1,它不支持任何Python 2版本。可能,您的pip没有损坏,但不支持您的Python。也许您必须手动安装较低的pip(使用python -m ensurepip
之类的东西,或者寻找get-pip.py
脚本)。
如果您希望Pip在Python 3下运行
也许你的问题是:你想在Python 3上运行pip,但它在Python 2上运行。可以用python3 -m pip
代替pip
。这样,你就可以用Python 3调用pip了。