How can I find where Python is installed on Windows?

It would be either of

  • C:\Python36
  • C:\Users\(Your logged in User)\AppData\Local\Programs\Python\Python36

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

If you have Python in your environment variable then you can use the following command in cmd or powershell:

 where python

or for Unix enviroment

 which python

command line image :

enter image description here


In your Python interpreter, type the following commands:

>>> import os
>>> import sys
>>> os.path.dirname(sys.executable)
'C:\\Python25'

Also, you can club all these and use a single line command. Open cmd and enter following command

python -c "import os, sys; print(os.path.dirname(sys.executable))"