Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to install Scipy, Numpy, Scikit-Learn on my iMac, which runs on OSX Lion 10.8.5, the default Python is 2.7.2. I have downloaded Scipy, Numpy, Scikit-learn, but could not install them because my default Python is 2.7.2

I understand 4 versions of Python 2.3, 2.5, 2.6, 2.7 are present on my iMac. Wonder how to change my default Python to 2.6 ?



share|improve this question
What did you use to install multiple versions of Python? And what stops you from installing numpy and scipy on 2.7.2? – fjarri Oct 13 '13 at 12:06
I checked my iMac, found there are 4 versions of Python, they may come from OSX Lion. When I tried to install Numpy, got error message, saying that I need to have Python 2.6. That's why I want to set default Python to 2.6 – tianqi Oct 14 '13 at 0:07
That's quite strange, OSX is shipped with a single version of Python. Remnants of OS upgrades maybe? And the current stable version of numpy (1.7.1) definitely supports Python 2.7 (I have it installed for 2.7.5 and 3.3.2). This is not an answer to your question, but I would recommend leaving system Python alone altogether, and manage Python versions through pyenv. – fjarri Oct 14 '13 at 0:20
possible duplicate of osx: setting default python for files in terminal? – Michael Kjörling May 19 '15 at 11:30

I'm not familiar with Mac, but in Linux (and some other unixes), running such a command as root will set the default python executable to 2.6

cd $(dirname $(which python))
ln -sf python2.6 python
share|improve this answer

A quick shift between standard python versions on OSX

$: defaults write Version 2.5
$: python -V

#   [ Output ]
#   Python 2.5.6

$: defaults write Version 2.7
$: python -V

#   [ Output ]
#   Python 2.7.5

System-wide python Preferences

This preferences for python-apple are set on User basis. To set the default python version system wide, we write into /Library/Preferences/ You must be admin to do so.

$: sudo defaults write /Library/Preferences/ Version 2.5

If we decide to set the default python version system-wide, we should be able to define a user-specific python default version as well.

The environment variable VERSIONER_PYTHON_VERSION

We can use the environment variable VERSIONER_PYTHON_VERSION in addition to our preferences. This environment variable takes precedence over settings in preferences files!

$: python -V

#   [ Output ]
#   Python 2.5.6
share|improve this answer

You must log in to answer this question.

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