How do I know which Python install is being used?

Solution 1:

/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
python2
$readlink /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2
python2.7

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 :

/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOs/Python

Solution 2:

If you are coding in python, you may wanna:

import sys
sys.path

The path would probably show you which version of python you are using.