I'm doing a bunch of python development and also just updated OS to Mountain Lion.

I had replaced to original Python versions with Snow Leopard using the GUI from Python.org, then added links in /usr/bin:

lrwxr-xr-x  1 root  admin  71 Oct 22 18:12 python -> ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

So now I have what I think are all the python version that are part of OSX 10.8.5 (2.5, 2.6, 2.7) located in:


and linked from /usr/bin

And ALSO the ones I installed with the GUI located in:


But I'm planning to use the versions I install with fink, which is a port tree similar to macports which are/will be located in:


So I have commented out the PATH exports in ~/.bash_profile that pointed to the non-fink executables:

#export PATH

#export PATH

And added:

#  for Fink:
export PATH=$PATH:/sw/bin
. /sw/bin/init.sh

I don't totally understand shell scripting yet, but init.sh initializes fink, I think mostly by adding elements to $PATH and other environment variables.

Previously I have installed various packages with homebrew, macports and various GUIs and am hoping to have a more comprehensible environment this time around.

At the moment I need to install postgreSQL and a bunch of python modules including pip, virtualenv, virtualenvironmentwrapper, psycopg.

It looks like the easy_install executable (binary executable?) lives (alongside easy_install-2.5, 2.6 and 2.7) in /usr/bin/.

So my questions are:

  1. Is there any reason to have more than one copy of each version of Python?

  2. Will python-dependent applications work as long as there's a link in /usr/bin/ to a working, executable python library, and the location of the Python executable is in the $PATH?

  3. Is there much reason to keep Python2.5 at this point?

  4. sudo easy_install-2.7 pip worked, so what exactly is -rwxr-xr-x 2 root wheel 925 Oct 23 14:48 easy_install for?



Answer to number 1 is yes.

The fink developers recommend NOT removing the OSX versions of Python, simply because they are not terribly large files and may be necessary for certain OSX functions and programs.

And I want to have an additional version of at least python2.7 installed by fink, because it's a port tree that's designed to create a UNIX-like directory structure, which will hopefully make PostgreSQL and python play nicely together.

As far as question number 2, I'm not sure. I think this would work, but leaving the original OSX versions installed avoids the issue.

Question 3: yes. - see answer to question 1.

Making the fink version the one that runs via the terminal is a matter of:

  1. make sure the directory containing the fink python binary precedes the OSX (or GUI-installed one) in the PATH, which can be done in users .profile or .bash_profile (located in directory ~/, the user's root) by either invoking the fink init script, . /sw/bin/init.sh, OR making sure that export PATH=/sw/bin:$PATH is included in the file AFTER any other line that exports a PATH with one of the other python paths at the beginning. For example, export PATH=/usr/bin:$PATH or export PATH=/usr/local/bin:$PATH.

  2. Unless we want to invoke the python cli like python2.7, we'll need to make a symbolic link in the /sw/bin directory that points "python" to "python2.7", which is done by using sudo ln -s *source* *link*, which in this case looks like:

    sudo ln -s /sw/bin/python2.7 /sw/bin/python

Not sure what the answer to question 4 is yet, but am seeing that any libraries that exist in /sw/bin are being called from there, as opposed to other installations. Good.

Got a copy of Learning UNIX for OS X Mountain Lion that looks quite promising.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .