1

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 ?

Thanks

Tian

4
  • 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 – Rider44 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? – user May 19 '15 at 11:30
0

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
0

A quick shift between standard python versions on OSX

$: defaults write com.apple.versioner.python Version 2.5
$: python -V

#   [ Output ]
#   Python 2.5.6

$: defaults write com.apple.versioner.python 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/com.apple.versioner.python. You must be admin to do so.

$: sudo defaults write /Library/Preferences/com.apple.versioner.python 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!

$: export VERSIONER_PYTHON_VERSION=2.5
$: python -V

#   [ Output ]
#   Python 2.5.6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.