How can I find where Python is installed on Windows?


Question

I want to find out my Python installation path on Windows. For example:

C:\Python25

How can I find where Python is installed?

1
124
5/16/2018 1:46:11 PM

Accepted Answer

>>> import os
>>> import sys
>>> os.path.dirname(sys.executable)
'C:\\Python25'
237
3/15/2009 1:17:29 PM

If you need to know the installed path under Windows without starting the python interpreter, have a look in the Windows registry.

Each installed Python version will have a registry key in either:

  • HKLM\SOFTWARE\Python\PythonCore\versionnumber\InstallPath
  • HKCU\SOFTWARE\Python\PythonCore\versionnumber\InstallPath

In 64-bit Windows, it will be under the Wow6432Node key:

  • HKLM\SOFTWARE\Wow6432Node\Python\PythonCore\versionnumber\InstallPath

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon