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
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ python_environment.htm
Python - Environment Setup
In the csh shell โˆ’ type setenv PATH "$PATH:/usr/local/bin/python" and press Enter. In the bash shell (Linux) โˆ’ type export PATH="$PATH:/usr/local/bin/python" and press Enter.
Discussions

ubuntu - How to set up Python path? - Unix & Linux Stack Exchange
root1@master:/usr/lib/python2.7$ ... [GCC 4.8.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> ... If you are just looking for python interpreter and want it to include in your script then just find the python binary path by the command which ... More on unix.stackexchange.com
๐ŸŒ unix.stackexchange.com
December 31, 2015
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
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 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
๐ŸŒ
Great Learning
mygreatlearning.com โ€บ blog โ€บ it/software development โ€บ how to add python to path?
How To Add Python To Path?
November 15, 2024 - In the "System Properties" window, click on "Environment Variables." macOS and Linux: Open a terminal window. In the "Environment Variables" window (Windows) or terminal (macOS/Linux), find the "Path" variable under the "System variables" section.
๐ŸŒ
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 ...
Top answer
1 of 4
5

I'm assuming that when you installed anaconda 2, you manually set the PYTHONPATH environment variable, by putting something like

PYTHONPATH=/home/user/anaconda2/python
export PYTHONPATH

in your .bash_profile or .bash_rc.

But since you deleted the /home/user/anacanda2/ directory, that path no longer exists.

Thus you want to change PYTHONPATH to point to the executable in /usr/lib, by changing the above to

PYTHONPATH=/usr/lib/my_python_distribution
export PYTHON
2 of 4
3
  1. execute the command: echo $PATH

    root1@master:/usr/lib/python2.7$ echo $PATH
    /home/root1/anaconda3/bin:/home/root1/NAI/Execution/HDE/x86_64.linux/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/root1/java/jdk1.8.0_74/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/root1/NAI/hadoop-2.7.3/bin
    
  2. Remove your anaconda3 from your path variable that is

    /home/root1/anaconda3/bin:
    
  3. Again set PATH variable with remaining information like below

    export PATH=/home/root1/NAI/Execution/HDE/x86_64.linux/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/root1/java/jdk1.8.0_74/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/root1/NAI/hadoop-2.7.3/bin
    
  4. Execute python command and should redirect to your python interpreter

    root1@master:/usr/lib/python2.7$ python
    Python 2.7.14 (default, Sep 18 2017, 00:00:00) 
    [GCC 4.8.4] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 
    
๐ŸŒ
Quora
quora.com โ€บ How-can-I-find-where-Python-is-installed-on-Linux
How to find where Python is installed on Linux - Quora
It might be in /usr/lib/python, /usr/lib/local/python, /lib/python or some other place depending on the distro and package manager. The โ€˜whichโ€™ command can be used to show the path to any executable.
Find elsewhere
๐ŸŒ
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.

๐ŸŒ
Enterprise DNA
blog.enterprisedna.co โ€บ where-is-python-installed
Where is Python Installed? A Quick Guide โ€“ Master Data Skills + AI
In most Linux distributions, Python is installed by default and can be found in the /usr/bin/ directory. The installed versions usually include both Python 2 and Python 3. For Python 2.x, the executable is named python, while for Python 3.x, itโ€™s named python3.
๐ŸŒ
Eyesopen
docs.eyesopen.com โ€บ toolkits โ€บ python โ€บ quickstart-python โ€บ linuxosx_pythonpath.html
PYTHONPATH Installation โ€” Toolkits -- Python
Set the PYTHONPATH environment ... to find the openeye` directory. The PYTHONPATH environment variable can be set in your shell startup script ~/.bashrc For example, if the package was untarred into the /usr/local directory: PYTHONPATH=/usr/local/OpenEye-toolkits-python3-linux-x64-|pypkgversion| export PYTHONPATH ยท The syntax and location may vary if you use a shell other than bash. The equivalent can be done in Python code as follows: $ python ... >>> import sys >>> sys.path.append("/...
๐ŸŒ
Linux Mint Forums
forums.linuxmint.com โ€บ board index โ€บ main edition support โ€บ beginner questions
Python PATH - Linux Mint Forums
PATH is a shell construct (a standard shell construct: one you can expect any specific shell such as bash, dash, ash, ..., to support). PYTHONPATH is much less generic, since Python-interpreter specific, and serves a moreover very different purpose: it only provides the Python interpreter with a list of locations to search for imported modules, not the system with one to search for (Python) script/applications itself.
๐ŸŒ
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 ...
๐ŸŒ
Reddit
reddit.com โ€บ r/linuxmint โ€บ how to find out where i installed python 3.9?
r/linuxmint on Reddit: How to find out where I installed python 3.9?
November 26, 2020 -

I've installed python before on my main PC I installed it in /bin/sh.... that's something I didn't do on my laptop and now my program(geany) is looking for python in /bin/sh. How to fix this?

๐ŸŒ
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
The sys.path list typically includes ... for standard libraries and site-packages. You can view the current Python path by using the sys.path attribute in your Python code....
๐ŸŒ
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 first step is to locate the ... PATH environment variable. To find the Python executable, youโ€™ll need to look for a file called python.exe....