37

I am trying to get the installed path of python? Any idea how to get the python installed path from command line in windows. I don't want to set the environment variable?

Thanks,

thefourtheye
  • 233,700
  • 52
  • 457
  • 497
user2499879
  • 673
  • 3
  • 10
  • 16

3 Answers3

89

try opening up cmd and simply:

where python

By default, this searches your PATH for matches. More precisely:

Description: Displays the location of files that match the search pattern. By default, the search is done along the current directory and in the paths specified by the PATH environment variable.

Most windows python installers modify your PATH so this should find what doing python at the CLI will call.

roippi
  • 25,533
  • 4
  • 48
  • 73
48

Cross-platform solution using sys.executable

python -c "import sys; print(sys.executable)"

sys.executable

A string giving the absolute path of the executable binary for the Python interpreter, on systems where this makes sense.

falsetru
  • 357,413
  • 63
  • 732
  • 636
2

You can check registry by: HKLM SOFTWARE\Python\PythonCore\${PYTHON_VERSION}\InstallPath

or HKCU

histrio
  • 1,217
  • 13
  • 24
  • HKCU worked for me: PS C:\Windows\system32> Get-Item -Path Registry::HKEY_Current_User\Software\Python\PythonCore\3.6-32\InstallPath – Prashant Singh Aug 06 '17 at 18:16