First question:

which python though its usually /usr/bin/python for the 2.7

Second question:

From a terminal & python2.7: python2.7 yourfile.py.
Simailarly for 3.2: python3.2 yourfile.py though 3.2 isn't installed by default. (You can apt-get install python3.2.)

What python yourfile.py will do depends on which alternative is used for your python interpreter. You can change that by issuing update-alternatives python as root (or by using su).

Third question:

Environment variables are shell dependent, though you can write them out with echo $variable and set them with variable=value (from bash). The search path is simply called PATH and you can get yours by typing echo $PATH.

I hope this was helpful.

Answer from Wolfer on askubuntu.com
🌐
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.

Discussions

Python 3 install location - Stack Overflow
I am using Ubuntu 16.04 . Where is the python 3 installation directory ? Running "whereis python3" in terminal gives me: python3: /usr/bin/python3.5m-config /usr/bin/python3 /usr/bin/python3.... More on stackoverflow.com
🌐 stackoverflow.com
How to change default install location for python? - Stack Overflow
I am using RedHat Linux. Python 2.6 is already installed in usr/src/bin. When I install Python 2.7, it gets installed in usr/local/src/bin. Further, I need to install sklearn. When I try installing sklearn using pip, it refers to Python2.6 and not Python2.7. ... I think you can probably specify the location ... 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
python - Where does pip install its packages? - Stack Overflow
These two functions are part of ... These are the default locations for any package installed using pip, including, in particular, statsmodels. 2021-01-24T12:22:52.483Z+00:00 ... By default, on Linux, Pip installs packages to /usr/local/lib/python2.7/dist-packages... More on stackoverflow.com
🌐 stackoverflow.com
🌐
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]['', ...
🌐
LinuxVox
linuxvox.com › blog › where-is-python-installed-linux
Where is Python Installed on Linux: A Comprehensive Guide — linuxvox.com
Most Linux distributions come with a system-wide Python installation. This is usually located in directories like /usr/bin or /usr/local/bin.
Find elsewhere
🌐
Swaroopch
python.swaroopch.com › installation.html
Installation · A Byte of Python
CAUTION: Make sure you check option Add Python 3.5 to PATH. To change install location, click on Customize installation, then Next and enter C:\python35 (or another appropriate location) as the install location.
🌐
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 - The python os module and the systems module(sys) are modules that are in built and comes preinstalled with the default Python installation. They help us interact with the operating system via Python code. You can also import them and run commands to find the location of the Python executable file on your computer in the following way:
🌐
Yasoob Khalid
yasoob.me › 2013 › 07 › 30 › python-install-location-and-version
Python install location and version - Yasoob Khalid
July 29, 2013 - On linux just type these two commands in the terminal: # for python install path root@bt:/$ which python /usr/bin/python # for python version; root@bt:/usr/bin$ python -V Python 2.7.5 · On windows type this commands in the command prompt for python version: ... This comes in handy when you need to know the version and path of python real quick.
🌐
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 prompt. I wanted to add Environmental Variables. Please help.
🌐
Ffy00
ffy00.github.io › blog › 02-python-debian-and-the-install-locations
Filipe Laíns - Python, Debian, and the install locations
March 30, 2026 - The site packages directory is a place for user-installed packages, it is a mechanism that that Python us to customize the default environment of the interpreter. That means packages installed there will be available in the interpreter, so you will be able to import them. This functionality is provided by the site module, and can be disabled by passing the -S option to the interpreter. Install locations on Linux are governed by the Filesystem Hierarchy Standard (FHS) specification, at least in the distributions that adopt it, which are most of them, including Debian.
🌐
Linux Hint
linuxhint.com › python-packages-installed-linux
Where Are Python Packages Installed in Linux – Linux Hint
different location described in the first section of this document. Like in Debian/Ubuntu, Python packages without defined specific architecture are installed under the /usr/lib/python<version> directory. But specific architecture Python packages in Red Hat are stored under a descriptive directory ...
🌐
AskPython
askpython.com › python › examples › find-where-python-is-installed
Where Is Python Installed? Find Its Path - AskPython
1 month ago - An IDE or a full-path launch can still start an interpreter outside those locations. Use sys.executable to identify the interpreter running the process, and run the site module with that same interpreter to inspect its library directories. In Windows Command Prompt or PowerShell, use python. In a macOS or Linux shell, use python3.
🌐
Python
docs.python.org › 3.3 › install › index.html
Installing Python Modules — Python 3.3.7 documentation
September 19, 2017 - If you build Python yourself on Linux (or any Unix-like system), the default prefix and exec-prefix are /usr/local. The default installation directory on Windows was C:\Program Files\Python under Python 1.6a1, 1.5.2, and earlier.
🌐
Python
docs.python.org › 3 › using › unix.html
2. Using Python on Unix platforms — Python 3.15.2 documentation
Getting and installing the latest version of Python: On Linux: Python comes preinstalled on most Linux distributions, and is available as a package on all others. However there are certain features...
🌐
Alliance for OpenUSD
forum.aousd.org › general › announcements
Changing default install location for Python modules - Announcements - Alliance for OpenUSD
June 16, 2026 - The default install location for Python modules will be changing in the next OpenUSD release to the standard site-packages directory instead of the hard-coded “lib/python” directory.
🌐
Super User
superuser.com › questions › 1419770 › how-can-i-change-the-location-that-python-binaries-install-to-when-building-from
linux - How can I change the location that python binaries install to when building from source? - Super User
April 1, 2019 - These commands don't give me any errors, but they don't do what I expect them to do either. They're supposed to install the new python binary into /usr/bin/python3.7, however, that file is never created.
🌐
Tutorialspoint
tutorialspoint.com › python › python_environment.htm
Python - Environment Setup
This installs Python at standard location /usr/local/bin and its libraries at /usr/local/lib/pythonXX where XX is the version of Python. Red Hat Enterprise Linux (RHEL 8) does not install Python 3 by default.