Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'pip' python3

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.

like image 324
Amir Avatar asked May 02 '20 14:05

Amir


People also ask

How do I fix ModuleNotFoundError No module named pip?

The Python "ModuleNotFoundError: No module named 'pip'" occurs when pip is not installed in our Python environment. To solve the error, install the module by running the python -m ensurepip --upgrade command on Linux or MacOS or py -m ensurepip --upgrade on Windows.

What is usr bin python3 No module named pip?

While this error can come due to multiple reasons but in most of the cases you will see this error because of pip package not installed in your System. So to solve this kind of error, you need to simply install pip package from the default Repo.

How do I install pip in Python?

Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists. Step 4: Now wait through the installation process. Voila!


1 Answers

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

like image 179
Massimo Avatar answered Sep 24 '22 15:09

Massimo