解决 ModuleNotFoundError: No module named ‘pip’
描述
对 pip 进行升级,失败后出现 ModuleNotFoundError: No module named 'pip' ,详细报错如下:
laona@DESKTOP-28NE7AC MINGW64 /f/PycharmWorkspace/urllib3 (main)
$ pip
Traceback (most recent call last):
File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Python39\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'
laona@DESKTOP-28NE7AC MINGW64 /f/PycharmWorkspace/urllib3 (main)
$ pip3
Traceback (most recent call last):
File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Python39\Scripts\pip3.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'
解决
# 允许 pip
python -m ensurepip
# 重装
python -m pip install --upgrade pip
|