Ask Different is a question and answer site for power users of Apple hardware and software. 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

If I type the command which python, then I get:

Oliviers-iMac:~$ which -a python

If I then type python --version, how do I know which Python install I'm getting the version of? Are the two locations above 2 different Python installs?

share|improve this question
which python i.e. without the -a tells you which one will be used – Mark Mar 28 '14 at 15:23
I suppose which one gets executed depends on the order in $PATH, right? – Olivier de Broqueville Mar 28 '14 at 15:56
@Oliver yes correct – Mark Mar 28 '14 at 18:12

/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python is most likely a symlink.

readlink on a simlink will give you the target.

For example on my Mavericks installation I have following :

$readlink /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
$readlink /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2

Which means when I run python it actually runs /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

Also there is something funny, when running /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

Try this

>>> import sys
>>> print sys.executable 

Which will return this :

share|improve this answer
Strange! I wonder why intermediary simlinks are required? Maybe it's because python 2.7 extends python 2 which extends python? – Olivier de Broqueville Mar 28 '14 at 14:59
By the way, when you say that /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python is most likely a simlink, do you mean that it points to /usr/bin/python? DO simlinks always point to binaries in /usr/bin? (Sorry for the noob questions!) – Olivier de Broqueville Mar 28 '14 at 15:07
symlink can point to anything anywere. File, directory, binary. There (a bit) like aliases. – Matthieu Riegler Mar 28 '14 at 15:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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