The environment variable PYTHONPATH is actually only added to the list of locations Python searches for modules. You can print out the full list in the terminal like this:

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

Or if want the output in the UNIX directory list style (separated by :) you can do this:

python -c "import sys; print(':'.join(x for x in sys.path if x))"

Which will output something like this:

/usr/local/lib/python2.7/dist-packages/feedparser-5.1.3-py2.7.egg:/usr/local/lib/
python2.7/dist-packages/stripogram-1.5-py2.7.egg:/home/qiime/lib:/home/debian:/us
r/lib/python2.7:/usr/lib/python2.7/plat-linux2:/usr/lib/python2.7/lib-tk:/usr/lib
/python2.7/lib-old:/usr/lib/python2.7/lib- dynload:/usr/local/lib/python2.7/dist-
packages:/usr/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages/PIL:/u
sr/lib/python2.7/dist-packages/gst-0.10:/usr/lib/python2.7/dist-packages/gtk-2.0:
/usr/lib/pymodules/python2.7
Answer from Hubro on Stack Overflow
Discussions

Where is python installed on Linux
Check /usr/bin/, most executables that come with the install should be there. More on reddit.com
🌐 r/learnpython
8
2
February 10, 2021
How do I find out my PYTHONPATH using Python? - Stack Overflow
If it is called without arguments, ... of sys.path on the standard output..." ... Caveat: If you have multiple versions of Python installed you should use a corresponding command python2 or python3. ... Sign up to request clarification or add additional context in comments. ... Same. Linux aaa.com ... More on stackoverflow.com
🌐 stackoverflow.com
How do I know python path on linux ubuntu? - Stack Overflow
In ubuntu linux if we want to set up python path we do something like this: export PYTHONPATH=/etc ... Now, how I would know what the current path I have? 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
🌐
Quora
quora.com › How-can-I-find-where-Python-is-installed-on-Linux
How to find where Python is installed on Linux - Quora
1) Use which/type/command to locate the executable ... These show the path of the executable that your shell will run (e.g., /usr/bin/python3, /usr/local/bin/python3, ~/.local/bin/python).
🌐
AskPython
askpython.com › home › determining the install path of python from the command line
Determining the Install Path of Python from the Command Line - AskPython
June 30, 2023 - In this article, we have seen how important it is to add Python to PATH to make it accessible through our command prompt. On Windows, there are 4 different methods via which you can find the location where your Python is present. On other operating systems such as Linux and macOS, there are ...
🌐
LabEx
labex.io › tutorials › python-how-to-check-the-python-system-path-to-find-necessary-modules-397953
How to check the Python system path to find necessary modules | LabEx
You can view the current Python path by using the sys.path attribute in your Python code. Let's create a simple Python script to see this in action. Open the WebIDE terminal and navigate to your project directory if you are not already there. The default directory is /home/labex/project. Now, create a new file named check_path.py in the /home/labex/project directory using the WebIDE editor.
🌐
GitHub
bic-berkeley.github.io › psych-214-fall-2016 › using_pythonpath.html
Using PYTHONPATH — Functional MRI methods
Give the variable name as PYTHONPATH and the value is the path to the code directory. Choose OK and OK again to save this variable. Now open a cmd Window (Windows key, then type cmd and press Return). Type: ... If you want your IPython sessions to see this new PYTHONPATH variable, you’ll have to restart your terminal and restart IPython so that it picks up PYTHONPATH from the environment settings. You can check ...
🌐
Reddit
reddit.com › r/learnpython › where is python installed on linux
r/learnpython on Reddit: Where is python installed on Linux
February 10, 2021 -

Hi, I have anaconda installed, so typing:

which python

just returns the anaconda path, however, I need to unearth the standard install location as a script is annoyingly asking for python2.7. Google unfortunately only tells you how to install it, and I know that, I've just forgotten where the binary is usually located on linux and google won't tell me that no matter what I type in.

UPDATE: Thanks guys, I found it looking in /usr/bin/ and /usr/local/bin/ and to my delight, it's not there, Just upgraded to Linux Mint 20 and there is python3.8. lovely.

Find elsewhere
🌐
Quora
quora.com › How-do-I-find-a-Python-path-in-Linux
How to find a Python path in Linux - Quora
Answer (1 of 5): This works with every executable - use the which command [code]$> which python3.9 [/code]If you are able to use the command ‘python3.9’ at the command line then the ‘which’ command above will tell you the path to that ...
🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › beginner questions
Python PATH - Linux Mint Forums
You supposedly started the /home/ozramsay/code/hello.py script with a line like #!/usr/bin/python telling the system which interpreter to run the script through. If indeed and if you additionally tell the system that the script is in fact executable through ... chmod +x ~/code/hello.py you can invoke it simply as hello.py due to ~/code being in your PATH.
🌐
Enterprise DNA
blog.enterprisedna.co › where-is-python-installed
Where is Python Installed? A Quick Guide – Master Data Skills + AI
To check the exact path of your Python installation, you can open the terminal and type which python or which python3. Pressing “Enter” will display the file path of the active Python version on your system. In most Linux distributions, Python is installed by default and can be found in ...
🌐
AskPython
askpython.com › home › how to get the pythonpath in shell?
How to Get the Pythonpath in Shell? - AskPython
May 30, 2023 - This allows the interpreter to reach for the modules and packages present at the same relative position as the Python file you’re programming in. Apart from this, you can append other directories where you want your interpreter to search for the modules and packages to sys.path list.
🌐
Real Python
realpython.com › add-python-to-path
How to Add Python to PATH – Real Python
January 30, 2023 - The quick fix for this is just adding your new Python directory before the old Python directory, though you’d probably want to clean your system of the bad Python installation too. Reordering PATH on Windows is relatively straightforward. You open the GUI control panel and adjust the order using the Move Up and Move Down buttons. If you’re on a UNIX-based operating system, however, the process is more involved. Read on to learn more. Usually, your first task when managing your PATH is to see what’s in there. To see the value of any environment variable in Linux or macOS, you can use the echo command:
🌐
CodeGenes
codegenes.net › blog › how-to-check-python-path
How to Check Python Path — codegenes.net
The sys module in Python provides access to some variables used or maintained by the Python interpreter and to functions that interact strongly with the interpreter. You can use the sys.path variable to check the Python path in a Python script.
🌐
W3docs
w3docs.com › python
How do I find out my PYTHONPATH using Python?
You can use the sys module in Python to access the sys.path variable, which contains a list of directories that Python looks in for modules to import.
🌐
Simplilearn
simplilearn.com › home › resources › software development › understanding the python path environment variable in python
Understanding the Python Path Environment Variable in Python [Updated]
September 14, 2025 - Python path is an environment variable used to maintain directories of custom Python libraries. Learn how to set a python path variable on Windows and Mac now!
Address   5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
AskPython
askpython.com › home › finding where python is installed (when it isn’t the default dir)
Finding Where Python Is Installed (when it isn't the default dir) - AskPython
April 10, 2025 - So which python helps locate not just the active Python interpreter, but also all available versions on your Linux/Unix system. Another option is using the type command with the -a flag: type -a python python is /usr/bin/python python is /usr/bin/python3 python is /usr/local/bin/python python is /home/preet/virtualenvs/analytics/bin/python · This displays all commands matching the name python across directories in your $PATH.
🌐
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?