python4ecology python4ecology - 1 year ago 110
Python Question

How to install pip in a new python installation

I recently installed python 2.7.2 on my Mac running OSX 10.6.8. Previously, I had version 2.6. I set my path in .bash_profile as follows:

export PATH=/usr/local/bin:$PATH
export PATH=/usr/local/share/python:$PATH

so that when I run python it will refer to my new installation. It does.

I would also like to use pip with my new installation, but the problem is that I already have the current version of pip installed at


I tried to re-install pip with:

easy_install pip

But, of course this does not put pip in the desired new directory


but simply refers to the existing version in /usr/local/bin/pip.

Can someone tell me how to fix this?

I would like to then use pip to install NumPy and SciPy in the correct directory (I was having trouble getting the SciPy installation to work with my old version of python, hence the new install).

If you'd like, you can visit the website where I found instructions for installing python 2.7, creating/updating my .bash_profile, installing pip, and NumPy and SciPy. Might provide some insight, or I'm happy to give more details if needed. Thanks!

Answer Source

Install distribute as per the instructions at . Make sure you specify the full path to the python executable (/usr/local/share/python/python or smth in your case).

$ curl -O
$ /usr/local/share/python/python

Then you should have /usr/local/share/python/easy_install.

After that, run:

$ /usr/local/share/python/easy_install pip

Then you should have /usr/local/share/python/pip.

Depending on the ordering of things in your PATH, either your old, or the newly installed pip is executed when you execute the pip command, so you either might have to adapt your PATH, or specify the full path to /usr/local/share/python/pip when installing eggs.

(shameless plug: In any case, you might consider using virtualenv for installing packages into a "project" specific isolated environment, as opposed to installing them globally.)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download