Problem scenario:
Python upgrade pip: python -m pip install --upgrade pip An error occurred during execution, and then use the pip command to report an error:
D:\python\python.exe: No module named pip
Cause Analysis:
In the process of upgrading pip, an error occurred, or it terminated abnormally, causing the old version of pip to be uninstalled, but the new version of pip was not installed successfully, resulting in the pip command being unavailable. Going back to the log, we found pip An error occurred during the upgrade:
solution:
1. Reinstall pip:
python -m ensurepip
2. Upgrade pip again
python -m pip install --upgrade pip