Adam Matan
Adam Matan

Reputation: 136161

Mac OSX: Switch to Python 2.7.3

I've installed the Mac OSX Python 2.7.3, and tried switching to the new version:

$ python2.7 -V
Python 2.7.3         # It was installed
$ python -V
Python 2.6.1         # Default is 2.6
$ export VERSIONER_PYTHON_VERSION=2.5
$ python -V
Python 2.5.4         # I can switch to 2.5
$ export VERSIONER_PYTHON_VERSION=2.6
$ python -V
Python 2.6.1         # And 2.6

But:

$ export VERSIONER_PYTHON_VERSION=2.7
$ python -V
python: VERSIONER_PYTHON_VERSION environment variable error (ignored)
Python 2.6.1

Can't switch to 2.7! Why is that?

Upvotes: 6

Views: 7333

Answers (3)

mmmmmm
mmmmmm

Reputation: 32661

The python.org install will put a python executable in /usr/local/bin . Apple's python is in /usr/bin

To call the python.org python you can use its full path /usr/local/bin/python or change your path to put /usr/local/bin before /usr/bin. You will still be able to call Apple's python by using its full path /usr/bin/python

Some python installs e.g. Macports provide a tool that provides symbolic links to various python installs and allows you to switch between them.

Upvotes: 5

bxio
bxio

Reputation: 43

I don't think we can switch the python version on the Mac OS X without resorting to something like MacPorts or ActivePython.

Upvotes: 1

Takashi Matsuo
Takashi Matsuo

Reputation: 3436

I think it's because VERSIONER_PYTHON_VERSION is specific to python packages built by apple.

Upvotes: 0

Related Questions