gpt4 book ai didi

python-2.7 - 为什么我在尝试升级 pip 后收到 DistributionNotFound 错误?

转载 作者:行者123 更新时间:2023-12-02 00:51:56 25 4
gpt4 key购买 nike

最近运行 yolk -U 我注意到 pip 需要从 1.2.1 升级到 1.4.1,并尽职尽责地尝试使用

升级它
pip install --upgrade pip

虽然再次运行 yolk -U 似乎确认升级成功(pip 不再被列为过时),但这会生成一条错误消息

Downloading/unpacking pip from https://pypi.python.org/packages/source/p/pip/pip-1.4.1.tar.gz#md5=6afbb46aeb48abac658d4df742bff714
Downloading pip-1.4.1.tar.gz (445kB): 445kB downloaded
Running setup.py egg_info for package pip

warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.rst' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
Installing collected packages: pip
Found existing installation: pip 1.2.1
Uninstalling pip:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/basecommand.py", line 107, in main
File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/commands/install.py", line 261, in run
File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 1162, in install
File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 495, in uninstall
File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 1492, in remove
File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/util.py", line 273, in renames
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/local/bin/pip'

并且在我随后尝试使用 pip 时也这样做:

Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
continue # try the next older version of project
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve

pkg_resources.DistributionNotFound: pip==1.2.1

我看到类似的问题have been reported之前,但我看到的建议都无法解决此问题。

我陷入困境,无法维护我的 Python 安装。

<小时/>

我在 /usr/bin/python 中使用操作系统 10.8.4、Python 2.7.2。

最佳答案

根据这一行:

OSError: [Errno 13] Permission denied: '/usr/local/bin/pip'

这似乎是 *nix 权限问题,请尝试使用 sudo 启动升级:

sudo pip install --upgrade pip

顺便说一句,我建议使用此升级方法:http://www.pip-installer.org/en/latest/installing.html#install-or-upgrade-pip

tl;dr版本(感谢OP提供的信息;)):

1.从 http://www.pip-installer.org/en/latest/installing.html#install-or-upgrade-pip 下载并启动 get-pip.py

2.如果您收到有关“无效命令'egg_info'”的错误,则需要使用 pip install --upgrade setuptools 或 easy_install -U 升级安装工具

关于python-2.7 - 为什么我在尝试升级 pip 后收到 DistributionNotFound 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18532861/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com