How to get the python.exe location programmatically?
This works in Linux & Windows:
Python 3.x
>>> import sys
>>> print(sys.executable)
C:\path\to\python.exe
Python 2.x
>>> import sys
>>> print sys.executable
/usr/bin/python
sys.executable is not reliable if working in an embedded python environment. My suggestions is to deduce it from
import os
os.__file__