ModuleNotFoundError: No module named 'pip' python3

老子叫甜甜 提交于 2021-01-25 06:25:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!