问题
I can't use pip and I don't know why. The error I get is shown below:
File "d:\python\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\python\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "D:\Python\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'
If I try py -3.8 -m pip install I get
D:\Python\python.exe: No module named pip.
If I use get-pip nothing happens.
If I try to upgrade pip nothing happens.
回答1:
Try
python -m ensurepip
This command activates pip.
Ref. https://docs.python.org/3/library/ensurepip.html
After this you can upgrade
python -m pip install --upgrade pip
回答2:
Try this
python -m pip install --upgrade pip
A suggestion, try to use anaconda or virtual env to avoid such issues.
来源:https://stackoverflow.com/questions/61561218/modulenotfounderror-no-module-named-pip-python3