pythonwindowspath

How can I find where Python is installed on Windows?


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

C:\Python25

How can I find where Python is installed?


Solution

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