🌐
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 command. If you need to find the path from within ...
Discussions

python - How to get the PYTHONPATH in shell? - Stack Overflow
debian@debian:~$ echo $PYTHONPATH /home/qiime/lib/: debian@debian:~$ python Python 2.7.3 (default, Jan 2 2013, 16:53:07) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "li... More on stackoverflow.com
🌐 stackoverflow.com
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
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
People also ask

How do I add PYTHONPATH inside a Python script?
Changing os.environ["PYTHONPATH"] changes the process environment and can affect child processes started afterwards. For an import in the running interpreter, add the intended directory to sys.path before importing, or install the package into that interpreter’s environment.
🌐
askpython.com
askpython.com › python › built-in-methods › pythonpath-in-shell
How to Get the Pythonpath in Shell? - 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 PYTHONPATH required to import installed packages?
Python adds applicable package locations through its normal initialization. If an installed package cannot be imported, identify the active interpreter before adding extra paths.
🌐
askpython.com
askpython.com › python › built-in-methods › pythonpath-in-shell
How to Get the Pythonpath in Shell? - AskPython
🌐
AskPython
askpython.com › python › built-in-methods › pythonpath-in-shell
How to Get the Pythonpath in Shell? - AskPython
4 weeks ago - PYTHONPATH in Python concerns imports, so adding a Python executable to PATH solves a different task. You do not need to copy Python’s standard-library or site-packages directories into PYTHONPATH. In Bash on Linux or macOS, print the variable with printf, keeping its value together through ...
🌐
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
🌐
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 - 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 ...
🌐
AskPython
askpython.com › python › examples › find-where-python-is-installed
Where Is Python Installed? Find Its Path - AskPython
1 month ago - In a macOS or Linux shell, use python3 to ask the running process for its executable path.
🌐
Quora
quora.com › How-can-I-find-where-Python-is-installed-on-Linux
How to find where Python is installed on Linux - Quora
Answer (1 of 19): It depends on what you mean by “installed.” The binary can be located with the which command, but you might also care where components of the python library are. You can run your version of python and type: [code]import sys sys.path [/code]On my system, I get: [code]['', ...
🌐
YouTube
youtube.com › watch
Find python path - Locate python install location - YouTube
When you have multiple Python installations, it can be confusing to figure out which Python your program is currently using, and how to locate its installati...
Published: July 30, 2019
🌐
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
🌐
Tutorialspoint
tutorialspoint.com › python › python_environment.htm
Python - Environment Setup
Note − C:\Python is the path of the Python directory · Here are important environment variables, which can be recognized by Python − · There are three different ways to start Python − · You can start Python from Unix, DOS, or any other system that provides you a command-line interpreter or shell window. Enter python the command line. Start coding right away in the interactive interpreter. $python # Unix/Linux or python% # Unix/Linux or C:> python # Windows/DOS
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.
    >>> 
    
🌐
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…
🌐
LinuxVox
linuxvox.com › blog › python-path-linux
Mastering Python Paths on Linux — linuxvox.com
You can inspect sys.path at any time to see exactly which directories Python is searching. The site module handles adding site-packages directories during initialization. The PYTHONPATH is an environment variable that you can set in your Linux system. It is a colon-separated list of directories.
Top answer
1 of 3
73
  1. PYTHONPATH is an environment variable which you can set to add additional directories where python will look for modules and packages. e.g.:

    # make python look in the foo subdirectory of your home directory for   
    # modules and packages 
    export PYTHONPATH=${PYTHONPATH}:${HOME}/foo 
    

    Here I use the sh syntax. For other shells (e.g. csh,tcsh), the syntax would be slightly different. To make it permanent, set the variable in your shell's init file (usually ~/.bashrc).

  2. Ubuntu comes with python already installed. There may be reasons for installing other (independent) python versions, but I've found that to be rarely necessary.

  3. The folder where your modules live is dependent on PYTHONPATH and where the directories were set up when python was installed. For the most part, the installed stuff you shouldn't care about where it lives -- Python knows where it is and it can find the modules. Sort of like issuing the command ls -- where does ls live? /usr/bin? /bin? 99% of the time, you don't need to care -- Just use ls and be happy that it lives somewhere on your PATH so the shell can find it.

  4. I'm not sure I understand the question. 3rd party modules usually come with install instructions. If you follow the instructions, python should be able to find the module and you shouldn't have to care about where it got installed.

  5. Configure PYTHONPATH to include the directory where your module resides and python will be able to find your module.

2 of 3
46
  1. PYTHONPATH is an environment variable
  2. Yes (see https://unix.stackexchange.com/questions/24802/on-which-unix-distributions-is-python-installed-as-part-of-the-default-install)
  3. /usr/lib/python2.7 on Ubuntu
  4. you shouldn't install packages manually. Instead, use pip. When a package isn't in pip, it usually has a setuptools setup script which will install the package into the proper location (see point 3).
  5. if you use pip or setuptools, then you don't need to set PYTHONPATH explicitly

If you look at the instructions for pyopengl, you'll see that they are consistent with points 4 and 5.

🌐
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?