4

On Windows, how do I find the path to python.exe from within a script at runtime?

SilentGhost
  • 307,395
  • 66
  • 306
  • 293

1 Answers1

11
>>> import sys
>>> sys.executable
'C:\\Program Files\\Python31\\pythonw.exe'
SilentGhost
  • 307,395
  • 66
  • 306
  • 293