Find full path of the Python interpreter?
sys.executable
contains full path of the currently running Python interpreter.
import sys
print(sys.executable)
which is now documented here
Just noting a different way of questionable usefulness, using os.environ
:
import os
python_executable_path = os.environ['_']
e.g.
$ python -c "import os; print(os.environ['_'])"
/usr/bin/python