一、日志信息
^.^ pip3 install pytest
Traceback (most recent call last):
File "d:\python3.9.2\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\python3.9.2\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\python3.9.2\Scripts\pip3.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'
关键信息:ModuleNotFoundError: No module named 'pip’
二、原因
可能是新旧版本冲突。
三、解决方案
方案1
1)python -m ensurepip
2)python -m pip install --upgrade pip
方案2
sudo apt install --fix-missing python3-pip
方案3
1)curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
2)python3 get-pip.py --force-reinstall