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
Press Enter, and the system will display the paths where Python is installed. The terminal is a powerful scripting environment and newer command-line shell, offering a more modern approach to interacting with your system. If you use the terminal, the following steps will help you find where ...
Discussions

How do I find out my PYTHONPATH using Python? - Stack Overflow
This is the platform- and environment- independent way to get the current runtime's python path. 2012-11-29T19:06:51.873Z+00:00 ... This answer was much more helpful for my situation than the accepted answer. I know what my environment variables is. I needed to know where python decided to point besides my environment variable. 2013-04-17T19:55:44.12Z+00:00 ... I find it easier to use the following, since it makes it clear if ... More on stackoverflow.com
🌐 stackoverflow.com
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
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
path - Test if executable exists in Python? - Stack Overflow
On the basis that it is easier ... case - I checked for file does not exist and file is not executable and they both give OSError). It helps if the executable has something like a --version or --help flag that is a quick no-op. Copyimport subprocess myexec = "python2.8" try: subprocess.call([myexec, '--version'] except OSError: print "%s not found on path" % ... More on stackoverflow.com
🌐 stackoverflow.com
People also ask

Does sys.executable show the virtual environment's Python?
When Python runs inside a virtual environment, sys.executable points to that environment's interpreter. sys.base_prefix identifies the base installation prefix.
🌐
askpython.com
askpython.com › python › examples › find-where-python-is-installed
Where Is Python Installed? Find Its Path - AskPython
How do I find where Python installs packages?
Run the site module through the interpreter used by your program. On Windows use python -m site, and on macOS or Linux use python3 -m site.
🌐
askpython.com
askpython.com › python › examples › find-where-python-is-installed
Where Is Python Installed? Find Its Path - AskPython
Is where.exe python the same as sys.executable?
where.exe searches the current directory and PATH for matching files. sys.executable reports the executable running the current Python process.
🌐
askpython.com
askpython.com › python › examples › find-where-python-is-installed
Where Is Python Installed? Find Its Path - AskPython
🌐
AskPython
askpython.com › python › examples › find-where-python-is-installed
Where Is Python Installed? Find Its Path - AskPython
1 month ago - An IDE may select its interpreter in project settings, so a check in its integrated console is more useful than a lookup in an unrelated shell. The shell resolves names such as python and python3 through PATH. This environment variable tells the shell which directories to search, and activating an environment can change the result. Use the same Python command that runs your script.
🌐
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 - Screenshot by Idowu Omisola -- No attribution required · To see if Python is already added to the Windows PATH, open the terminal and type python --version, then hit the Enter key.
Find elsewhere
🌐
Great Learning
mygreatlearning.com › blog › it/software development › how to add python to path?
How To Add Python To Path?
November 15, 2024 - Now, if you type in the command ‘python’ in the Terminal, no error will be raised. Instead, a the installed python version will be displayed, as shown in the figure below, which will confirm that Python has been successfully added to the Path. Adding Python to the system's PATH is a crucial step for any Python developer or enthusiast.
🌐
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?

🌐
Medium
medium.com › @anandbanshijha › 1-locate-the-python-executable-6212208c9ade
1. Locate the Python Executable. First, find where Python is installed… | by Anandbanshijha | Medium
February 20, 2026 - If your Python installation appears in the list, select it. If it doesn’t appear, select the option to “Enter interpreter path…” or “Find” and paste the path you copied earlier to the python.exe file.
🌐
YouTube
youtube.com › watch
How to Find Python Installation Location in Windows (3 Easy Methods) 🐍 - YouTube
In this video, you will learn simple and easy methods to find the Python installation path on a Windows system. Knowing the Python location is useful when se...
Published: March 16, 2026
🌐
Devloprr
devloprr.com › other › how-to-find-python-path
How To Find Python Path - devloprr.com
We can use sys. prefix it gives the python path where the python is installed in the virtual environment.
🌐
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
🌐
PyTutorial
pytutorial.com › how-to-check-if-python-is-installed
PyTutorial | How to Check If Python Is Installed
February 13, 2026 - You can use the command line to check this too. Use the which command on macOS and Linux. Use where on Windows. # On macOS/Linux which python3 # On Windows in PowerShell where python · This command returns the full path to the executable.
🌐
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…
🌐
YouTube
youtube.com › watch
How to Find Python Installation Path in Windows 10/11 (2023) - YouTube
In this video I'll show you how to find python installation path in windows 10 or windows 11. Python installation path by default is C:\Users\USERNAME\AppDat...
Published: November 20, 2023
🌐
Reddit
reddit.com › r/learnpython › the absolute maze that is installing python and path variables
r/learnpython on Reddit: The absolute maze that is installing python and path variables
January 28, 2022 -

I've installed python on 1 computer successfully after hours of reading stackoverflow suggestions, youtube videos, documentation etc. And after getting it on there and working I was so frustrated and lost that I had no idea what actions from which source actually worked.

Can someone walk me through this from step 1 why python never works after running the installer and needs all sorts of pointer adjustments in the PATH variable or X other variable like PYTHON PATH to places I can't even manage to keep track of? More specifically, today with a fresh install, what needs to be done to get python to actually install and be detectable by commands.

I'm obviously new, and mostly illiterate to the command prompt so that's part of my difficulty with going through stack overflow where answers 1 through 5 all do something completely different all in command prompt with various opaque arguments, hidden references, implied actions, implied paths etc.

🌐
GUVI
guvi.in › blog › python › how to check if python is installed: windows, mac & linux (2026 guide)
How to Check if Python is Installed (2026 Guide)
July 21, 2026 - Both commands check whether Python is installed and display the installed version. If Python Is Installed, you will see output similar to: ... This confirms Python is installed, correctly added to the system PATH, and the displayed version is the active default interpreter.
🌐
AskPython
askpython.com › python › built-in-methods › pythonpath-in-shell
How to Get the Pythonpath in Shell? - AskPython
4 weeks ago - For a file launched as a script, the normal first entry is that script’s directory, rather than an empty string. PYTHONPATH supplements this initialization, so its text cannot reproduce the entire sys.path list. If two terminals disagree, print sys.executable in each to identify the interpreter ...