OS: Mac OS X 10.7.5 Python Ver: 2.7.5
I have installed setuptools 1.0 with ez_setup.py from https://pypi.python.org/pypi/setuptools Then I download pip.1.4.1 pkg fr
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.
On some kind of linux like ubuntu, first, do apt-get update and then try installing the python-pip package. without apt-get update, you might get error such as
E: Unable to locate package python-pip
1.Update :
sudo apt-get update
2.Install the pip package
For python2
sudo apt-get install python-pip
or
For python3
sudo apt-get install python3-pip
And done!
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
I solved a similar error on Linux by setting PYTHONPATH to the site-packages location. This was after running python get-pip.py --prefix /home/chet/pip
.
[chet@rhel1 ~]$ ~/pip/bin/pip -V
Traceback (most recent call last):
File "/home/chet/pip/bin/pip", line 7, in <module>
from pip import main
ImportError: No module named pip
[chet@rhel1 ~]$ export PYTHONPATH=/home/chet/pip/lib/python2.6/site-packages
[chet@rhel1 ~]$ ~/pip/bin/pip -V
pip 9.0.1 from /home/chet/pip/lib/python2.6/site-packages (python 2.6)
I had a similar problem with virtualenv
that had python3.8
while installing dependencies from requirements.txt
file. I managed to get it to work by activating the virtualenv
and then running the command python -m pip install -r requirements.txt
and it worked.
I just needed to replace pip
with pip3
so I ended up running the command as follows: pip3 install matplotlib