Switch between multiple Python’s version on Mac OSX

May 23rd, 2011 by Regaz

The easiest way to switch between severals Python’s versions on Mac OSX is
of installing it by MacPorts and switching between them by python_select.

You can provide to install some Python’s versions like:

sudo port install python25
sudo port install python26
sudo port install python31

The New Guide to Easy Python Version Switching on Mac

After that you install the switcher:

sudo port install python_select

For activate the newly installed Macports Pythons you still need to
Give Precedence to Macports installing PATH (default /opt/local/bin) on the default one /usr/local/bin.
This is done by Adding at the end of your Bash Configuration’s file this:

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

Now activate your changes:

source .bashrc

To have a list of your newly installed environments:

python_select -l

Switching to python 3.1:

python_select python31

Tags: , ,