In your Python interpreter, type the following commands:

>>> import os, 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))"
Answer from elo80ka on Stack Overflow
🌐
CodeWithHarry
codewithharry.com › blogpost › how-to-find-python-installation-path
How to find the Python Installation Path on Windows? | Blog | CodeWithHarry
This classic method involves utilizing Windows' Command Prompt to find where Python is installed. Press Win + R to open the run window, type cmd, and press Enter. In the Command Prompt window, type the following command: ... Press Enter, and the system will display the paths where Python is ...
Discussions

windows - e pyhow to get python installed path from command line - Stack Overflow
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, More on stackoverflow.com
🌐 stackoverflow.com
Python Installation
Hello, I recently got python downloaded in my system. able to open all terminals, Idle windows able to access Pycharm. but really not sure where is the exact location of Python installed when i try to check from Command prompt. I wanted to add Environmental Variables. Please help. More on discuss.python.org
🌐 discuss.python.org
5
0
December 7, 2023
Quick Question: How do I view Python's location in command prompt?
Either via the command where from a cmd shell: where python Or via sys.executable from a Python shell: import sys sys.executable More on reddit.com
🌐 r/learnpython
4
1
November 11, 2021
Powershell cant run Python
All you have to do is add your python path to the environment variables and it should work fine. When you install python it should ask if you want to add python to environment variables/path and it should work. More on reddit.com
🌐 r/learnpython
48
36
November 12, 2018
🌐
Reddit
reddit.com › r/learnpython › quick question: how do i view python's location in command prompt?
r/learnpython on Reddit: Quick Question: How do I view Python's location in command prompt?
November 11, 2021 -

So I've been having trouble with Python and I want to know which installation I'm using (I have two user profiles on Windows, my old one and the one I made explicitly to code in, and they both have Python installed).

I tried looking it up, but it only led to this madness you see below:

    Microsoft Windows [Version 10.0.19043.1348]
    (c) Microsoft Corporation. All rights reserved.

    C:\Users\willi>!type python
    '!type' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\willi>type python
    The system cannot find the file specified.

    C:\Users\willi>type Python
    The system cannot find the file specified.

    C:\Users\willi>Python type
    Python: can't open file 'C:\Users\willi\type': [Errno 2] No such file or     directory

    C:\Users\willi>Python
    Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit     (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> python
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name 'python' is not defined
    >>> .quit
      File "<stdin>", line 1
        .quit
        ^
    SyntaxError: invalid syntax
    >>> quit
    Use quit() or Ctrl-Z plus Return to exit
    >>> quit()
    
    C:\Users\willi>python
    Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit     (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> !type Python
      File "<stdin>", line 1
        !type Python
        ^
    SyntaxError: invalid syntax
    >>> type
    <class 'type'>
    >>> type python
      File "<stdin>", line 1
        type python
         ^
    SyntaxError: invalid syntax
    >>> type Python
      File "<stdin>", line 1
        type Python
         ^
    SyntaxError: invalid syntax
    >>> type(Python)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name 'Python' is not defined
    >>>

How do I view Python's location in command prompt?

🌐
AskPython
askpython.com › python › examples › determine-install-path-of-python-cli
Determining the Install Path of Python from the Command Line - AskPython
June 30, 2023 - Hence, if Python is added to your PATH then it becomes easier and more accessible via the command prompt for future installations. In windows, go to your search bar, and write cmd or command prompt in it. Or, press windows key + R, and open “cmd”. ... Now we’ll run the following command in our command prompt to find the location of Python in our computer.
🌐
Python
docs.python.org › 3 › using › windows.html
4. Using Python on Windows — Python 3.14.6 documentation
System-wide installations of Python 3.3 and later will put the launcher on your PATH. The launcher is compatible with all available versions of Python, so it does not matter which version is installed. To check that the launcher is available, execute the following command in Command Prompt: ... You should find that the latest version of Python you have installed is started - it can be exited as normal, and any additional command-line arguments specified will be sent directly to Python.
🌐
pythontutorials
pythontutorials.net › blog › how-can-i-find-where-python-is-installed-on-windows
How to Find Where Python is Installed on Windows: Step-by-Step Guide to Locate Python Installation Path — pythontutorials.net
Whether you prefer using the command line, File Explorer, or your favorite IDE, we’ve got you covered. ... The Command Prompt is one of the quickest ways to find Python’s installation path. Here’s how: Press Win + R to open the "Run" dialog. ...
Find elsewhere
🌐
YouTube
youtube.com › watch
How to find python path in cmd - YouTube
find python path command line linuxpython location commandfind python install location windows 10find python path macfind python path ubuntucheck python path...
Published   June 27, 2023
🌐
AskPython
askpython.com › python › examples › find-where-python-is-installed
Finding Where Python Is Installed (when it isn't the default dir) - AskPython
April 10, 2025 - Using the where command or checking Python’s sys path returns the location. Also read: Pipenv: The New Packaging Tool For Python · The easiest way is to use the where command within the Command Prompt (CMD).
🌐
pythontutorials
pythontutorials.net › blog › how-to-get-python-installed-path-from-command-line
How to Get Python Installed Path from Command Line in Windows Without Setting Environment Variables — pythontutorials.net
Find the Install Path: Expand your version folder, then go to InstallPath. The (Default) value in the right pane shows the installation directory (e.g., C:\Program Files\Python311\). If you see 3.11 under PythonCore, the path will be listed ...
🌐
Python.org
discuss.python.org › python help
Python Installation - Python Help - Discussions on Python.org
December 7, 2023 - Hello, I recently got python downloaded in my system. able to open all terminals, Idle windows able to access Pycharm. but really not sure where is the exact location of Python installed when i try to check from Command…
🌐
Codebhaiya
codebhaiya.com › blog › how-to-find-the-python-installation-path-on-windows
How to find the Python Installation Path on Windows
May 3, 2024 - This classic method involves utilizing Windows' Command Prompt to find where Python is installed. Press Win + R to open run window, type cmd, and press Enter. In the Command Prompt window, type the following command: ... Press Enter, and the system will display the paths where Python is installed.
🌐
W3docs
w3docs.com › python
How can I find where Python is installed on Windows? | W3Docs
If you have multiple versions of Python installed, the where command will show the location of all of them. You can specify a specific version of Python by including the version number in the command: ... This prints the path to the Python 3.8 ...
🌐
Finxter
blog.finxter.com › home › learn python blog › how to find path where python is installed on windows?
How to Find Path Where Python is Installed on Windows? - Be on the Right Side of Change
June 23, 2021 - Alternatively, you can check your Python installation path in your Windows command-line by using the simple two-word command “where Python“. Here’s how this works on my Windows machine:
🌐
MakeUseOf
makeuseof.com › home › programming › how to add python to the windows path variable
How to Add Python to the Windows PATH variable
October 13, 2020 - Learn how to access Python from anywhere on the command line by adding it to your Windows PATH variable.
🌐
Microsoft Learn
learn.microsoft.com › en-us › windows › dev-environment › python
Python on Windows for beginners | Microsoft Learn
To set this variable from PowerShell, use: $env:PYTHONPATH='list;of;paths' just before you launch Python. Setting this variable globally through the Environment Variables settings is not recommended, as it may be used by any version of Python instead of the one that you intend to use. Where can I find help with packaging and deployment?
🌐
YouTube
youtube.com › watch
How To Find Python Location in Windows - YouTube
Welcome to Amulya's Academy YouTube channel. Today, we'll learn how to find where Python is installed on Windows. There are three methods to do so. Firstly, ...
Published   September 28, 2024
Views   396
🌐
Data to Fish
datatofish.com › add-python-to-windows-path
How to Add Python to Windows PATH
You should then see the New User Variable box. Type Path in the Variable name field. For the Variable value you will need to know the path to the Python that is installed on your computer. To find the path, search python, right click on the relevant search result and click Open file location: