python – ImportError: No module named pip

python – ImportError: No module named pip

I had the same problem.
My solution:

For Python 3

sudo apt-get install python3-pip

For Python 2

sudo apt-get install python-pip

On Mac using brew is a better option as apt-get is not available.
Command:

brew install python

In case you have both python2 & python3 installed on machine

python2.7 -m ensurepip --default-pip

simply should solve the issue.

If instead you are missing pip from python 3 then simply change python2.7 to python3 in the command above.

python – ImportError: No module named pip

With macOS 10.15 and Homebrew 2.1.6 I was getting this error with Python 3.7. I just needed to run:

python3 -m ensurepip

Now python3 -m pip works for me.

Leave a Reply

Your email address will not be published. Required fields are marked *