SyntaxFix
Write A Post
Hire A Developer
Questions
Just noting a different way of questionable usefulness, using os.environ:
os.environ
import os python_executable_path = os.environ['_']
e.g.
$ python -c "import os; print(os.environ['_'])" /usr/bin/python