Dnaiel Dnaiel - 25 days ago 14
Python Question

macOS X weird python

short Q,

In a mac OS sierra terminal,

If I do:

whereis python
/usr/bin/python


Then if I do:
/usr/bin/python
it opens python 2.10

but if I execute
python
it opens python 2.7.8.

How can I know whereis python 2.7.8 and why whereis points to a different python version than the default one?

wim wim
Answer

You can run python and check the sys.executable.

>>> import sys
>>> sys.executable
'/usr/bin/python'
Comments