user2762934
user2762934

Reputation: 2452

Installing Pip for Python 3.x

I am following instructions from http://www.leighsheneman.com/2014519easy-python-setup-for-a-mac/ to setup my mac for a development environment. I have successfully installed Python 2 and Python 3 via Homebrew, and after some steps to install related packages like SciPy, I get to the point of installing pip. Pip for Python 2.x installs perfectly with no trouble, via the command sudo easy_install pip. When it comes to pip for Python 3, I tried the command sudo easy_install pip3 as mentioned in the document I am following, and receive this error:

Searching for pip3
Reading https://pypi.python.org/simple/pip3/
Couldn't find index page for 'pip3' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or working download links found for pip3
error: Could not find suitable distribution for Requirement.parse('pip3')

What could be the problem in this case?

Upvotes: 2

Views: 10944

Answers (5)

user5683940
user5683940

Reputation:

Following the official Documentation it says :

To install pip, securely download get-pip.py :

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

Then run the following:

python get-pip.py

OR

python3 get-pip.py

Upvotes: 2

Pierre de Buyl
Pierre de Buyl

Reputation: 7293

The official instructions if you have Python but no pip are here: https://pip.pypa.io/en/latest/installing/

Upvotes: 0

nir0s
nir0s

Reputation: 1171

The article you posted is plain wrong stating that you can install the pip3 package. (If you check it out, you'll see that it tries to resolve https://pypi.python.org/simple/pip3/, which doesn't exist.)

Installing pip for a specific environment is done by executing the script (in this instance, easy_install) in the context of that specific python environment.

Right now, your easy_install script is running using your python2 environment.

When you install two python environments, the easy_install script will be defaulting to one of them. In the background, there are actually two easy_install scripts for you. One, easy_install-2.x and one easy_install-3.x, x being the relevant minor version.

So to install pip using the python3 easy_install, just run:

$ sudo easy_install-3.x pip

Or, alternatively, just run the easy_install script using python3:

$ sudo python3 $(which easy_install) pip

Regardless of that, I think you would be better off using the get-pip.py (https://bootstrap.pypa.io/get-pip.py) script instead which would make your life easier.

Upvotes: 1

numbermaniac
numbermaniac

Reputation: 788

Homebrew installs pip for you when you install Python. brew install python3 would have installed Python 3.6.0, and also pip3. You can then type pip3 in the terminal to run pip for Python 3. You don't need to use easy_install at all.

Upvotes: 2

Manan Mehta
Manan Mehta

Reputation: 5929

You should already have pip2 and pip3 if you used homebrew to install python2.x and python3.x. Try running pip3 -V in the terminal and see if it works. You can use pip3 install package-name to install python3 packages and pip2 install package-name to install python2 packages.

Run which pip to see the default default path.

Upvotes: 0

Related Questions