Why am I getting ImportError: No module named pip ' right after installing pip?

Solution 1:

Just be sure that you have include python to windows PATH variable, then run python -m ensurepip

Solution 2:

After running get_pip.py with python embed you have to modify your pythonXX._pth file. Add Lib\site-packages, to get something like this:

pythonXX.zip
.
Lib\site-packages
# Uncomment to run site.main() automatically
#import site

If you don't you will get this error:

ModuleNotFoundError: No module named 'pip'

or

python-3.8.2-embed-amd64\python.exe: No module named pip

λ pip
Traceback (most recent call last):
  File "runpy.py", line 193, in _run_module_as_main
  File "runpy.py", line 86, in _run_code
  File "python-3.8.2-embed-amd64\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'

λ python -m pip
python-3.8.2-embed-amd64\python.exe: No module named pip

Solution 3:

What solved the issue on my case was go to:

cd C:\Program Files\Python37\Scripts

And run below command:

easy_install.exe pip