Recently, I've been trying to upgrade my pip using the following command:
python -m pip install --upgrade pip
the process goes as follows:
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
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
What am I suppossed to do???
This is likely an issue with the pip
installation. You can fix it using the following steps:
Uninstall the current pip:
python -m pip uninstall pip setuptools
Download get-pip.py
from https://bootstrap.pypa.io/get-pip.py
Run the get-pip script:
python get-pip.py
Alternatively you can use, but it isn't recommended:
easy install --upgrade pip
FYI, I uninstalled pip as above and then ran a version check to verify:
python -m pip --version
and got
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
and got
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.
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 As Administrator, after upgrading to pip 21.0.1, uninstall pip (python -m pip uninstall) to fix the "ValueError".
Uninstall setup tools using this command:
python -m pip uninstall pip setuptools
Install setup tools again using this command:
pip install --upgrade setuptools
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.