On the 27th day of the November Gwen Challenge, check out the details of the event: the last Gwen Challenge 2021
There was a problem with PIP today, no matter what command was entered, an error was reported. Take a closer look at the picture below,
ModuleNotFoundError: No module named ‘PIP’
Apparently the PIP module can’t be found.
1 Causes of the problem
This was not the first time this problem had occurred, so I made a note of my mistakes.
The cause is that the PIP upgrade failed because the command was incorrect. Procedure According to my understanding, in plain English, because the command is too simple, your old PIP is uninstalled, but the new PIP cannot be installed, so your PIP is missing, which leads to errors now.
PIP install PIP -u
There is no permission to access.
The only way to fix this problem is to load the PIP.
2 to solve
ModuleNotFoundError: No module named ‘PIP’
To solve this problem, install the PIP back:
python -m ensurepip
The image below shows that it has been installed.
Then use the PIP command to test, it is working properly.
2.2 How can I Securely Update a PIP
The problem is resolved, but the next time the PIP may update the same error, so how to avoid it?
-
python -m pip install --upgrade pip
Write full Python commands.
I’m not sure how this works, but it works, and I’ve been doing it before. My personal feeling is that this works by updating PIP from python’s global perspective, rather than PIP updating PIP alone.
-
pip install --upgrade --user pip
In the first picture, I was prompted to add –user, which is to give permission.