How can I find where Python is installed on Windows?

Fang-Pen Lin picture Fang-Pen Lin · Mar 15, 2009 · Viewed 411.7k times · Source

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

C:\Python25

How can I find where Python is installed?

Answer

elo80ka picture elo80ka · Mar 15, 2009

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))"