[Pythonmac-SIG] total confusion with multiple pythons and pip

Christopher Barker Chris.Barker at noaa.gov
Wed Dec 23 20:02:09 CET 2009

Christopher Brewster wrote:
> I appear to have 4 different installations of Python on my reformatted Snow Leopard installation.

actually, 3 -- see below.

> Versions of Python:
> 1. came with SL
> I assume it is here:
> /usr/bin/python

yup -- but see below

> 2. From Python.org
> I assume it is the one here:
> /usr/local/bin/python

yup, but same note.

> 3. From Macports
> I know it is the one here:
> /opt/local/bin/python


> 4. I do not know where this came from:
> /Library/Frameworks/Python.framework/Versions/2.6/bin/python

That is the actual installation location for the python.org python. 
/usr/local/bin/python is a link to it.

In fact, Apple's python lives in 

> Clearly when I install something with macports, it is accessible only if I run the macports version of python.


> However, I have installed 'pip' and this seems to be installing
> packages so that they only work with the original python (in
> /usr/bin/python).

I haven't used pip, but the key is to run it with the python you want to 
use, which may mean making sure you install it into the python you want 
to use.

> Question: How do I get 'pip' to install correctly so as to be
> accessible with the current default python which appears to be the one
> installed from python.org?

from the pip docs: "pip does not have to be installed to use it, you can 
run python path/to/pip.py and it will work"

so that should do it. If you want to be extra careful, use 

> If I want to use the Macport python, how do I set this to be the
> default, or do I always have to call it via opt/local/bin/python?

That is determined by your PATH setting. Mine is set in ~/.bash_profile. 
It could be in a couple of other places (sigh).

macports put this line in mine:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

That puts the macports stuff in front of everything else in your system, 
so it will be found first.

(unless there is another PATH setting after that).


$ echo $PATH

to see what you've got now.

you can also do:

$ which python

to see what python (or any other command) it's finding.


Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov

More information about the Pythonmac-SIG mailing list