Reputation: 71
I'm currently working on a Mac with Mojave. I have successfully installed python 3.7 with brew
brew install python3
But I have tried several methods to install pip for python 3.7 (installing with get-pip.py, easy_install pip, etc.), which had worked for installing pip in the python 2.7 folder, but not in the python 3.7.
Currently when I call
pip --version
I get
pip 18.1 from /Library/Python/2.7/site-packages/pip (python 2.7)
And pip3 seems not to exist.
How can I get pip3 installed in the python 3.7 folder? Thanks!
Upvotes: 5
Views: 14515
Reputation: 71
Ok, so I still don't quite understand what's going on with pip3 in my device, but I found a way to install packages with pip in the right Python version:
python3 -m pip install [package]
It worked to install numpy which was my primary objective.
Upvotes: 2
Reputation: 1740
I think you should be using pip3 --version
instead of pip --version
,provided pip3
was installed successfully.
Check all versions of pip
installed on your machine using ls -ltr /usr/local/bin|grep pip
Then use the correct executable to query the version.
For example on my machine I get:
ls -ltr /usr/local/bin|grep pip
lrwxr-xr-x 1 abhinav admin 33 May 8 03:32 pip3.6 -> ../Cellar/python/3.6.5/bin/pip3.6
lrwxr-xr-x 1 abhinav admin 31 May 8 03:32 pip3 -> ../Cellar/python/3.6.5/bin/pip3
lrwxr-xr-x 1 abhinav admin 36 May 8 03:32 pip2.7 -> ../Cellar/python@2/2.7.15/bin/pip2.7
lrwxr-xr-x 1 abhinav admin 34 May 8 03:32 pip2 -> ../Cellar/python@2/2.7.15/bin/pip2
Now if I do
pip2 --version
pip 18.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)
pip3 --version
pip 18.1 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip (python 3.6)
As you can see in the above output, the path shown to you is dependent on where the executable is pointing.
So make sure your pip
is not pointing to python 2.7
Upvotes: 0
Reputation: 22588
If you want to ensure pip installed for python 3.7, try something like this:
wget https://bootstrap.pypa.io/get-pip.py
sudo python3.7 get-pip.py
Upvotes: 3
Reputation: 112
Maybe you're using an older version of Brew?
In that case run brew postinstall python3
Upvotes: 1