使用 python -m pip install --upgrade pip 的 pip 升级问题 [英] pip upgrade issue using python -m pip install --upgrade pip
问题描述
最近,我一直在尝试使用以下命令升级我的 pip:
Recently, I've been trying to upgrade my pip using the following command:
python -m pip install --upgrade pip
流程如下:
Downloading pip-21.0.1-py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 1.7 MB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.3.3
Uninstalling pip-20.3.3:
Successfully uninstalled pip-20.3.3
Rolling back uninstall of pip
然后一堆Moving to
行开始出现,然后出现错误:
Then a bunch of Moving to
lines start to appear, then comes the error:
ValueError: Unable to find resource t64.exe in package pip._vendor.distlib
我应该做什么???
推荐答案
仅供参考,我如上卸载了 pip,然后运行了版本检查以进行验证:
FYI, I uninstalled pip as above and then ran a version check to verify:
python -m pip --version
得到
pip 21.0.1 from C:\Program Files\Python39\lib\site-packages\pip (python 3.9)
觉得奇怪,我又重新运行了升级版:
Finding that odd, I reran the upgraded again:
python -m pip install --upgrade pip
得到
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in c:\program files\python39\lib\site-packages (21.0.1)
我意识到这是从用户帐户执行的.因此,我以管理员身份重新进行了升级.这次没有违约......"线.
I realize that this was being performed from user account. So, I re-did the upgrade as an Administrator. This time there was no "Defaulting ..." line.
似乎如果您在安装/升级 pip 时不小心,您可能会无意中将其可用性从全局更改为特定于用户,从而为将来的升级中断删除过程.
It seems that if you're not careful when installing/upgrading pip you can inadvertently change it's availability from global to user-specific, borking the removal process for future upgrades.
TL;DR 作为管理员,升级到 pip 21.0.1 后,卸载 pip (python -m pip uninstall) 以修复ValueError".
TL;DR As Administrator, after upgrading to pip 21.0.1, uninstall pip (python -m pip uninstall) to fix the "ValueError".
这篇关于使用 python -m pip install --upgrade pip 的 pip 升级问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!