The most common method to install Python on Linux is via the distribution's package manager, which automatically handles dependencies and system integration. For Ubuntu/Debian/Mint, run sudo apt update followed by sudo apt install python3 python3-pip. For Fedora/RHEL/CentOS, use sudo dnf install python3 python3-pip (or yum on older versions). For Arch Linux, execute sudo pacman -S python python-pip.

Important considerations include:

  • Version Locking: On Debian-based systems, the major Python version is often locked to the OS release; to get a newer version, you must upgrade the OS, use a third-party repository (like the deadsnakes PPA on Ubuntu), or install pyenv.

  • pip Installation: While often included, pip can be explicitly installed via sudo apt install python3-pip (Debian/Ubuntu) or sudo dnf install python3-pip (Fedora/CentOS).

  • Compilation: Compiling from source code is an advanced option recommended only for specific cases where a version not available in repositories is required.

  • Virtual Environments: To avoid breaking system tools, it is recommended to use virtual environments (python3 -m venv) for project-specific dependencies.

DistributionPackage ManagerInstallation Command
Ubuntu/Debian/Mintaptsudo apt install python3 python3-pip
Fedora/RHEL/CentOSdnf / yumsudo dnf install python3 python3-pip
Arch Linuxpacmansudo pacman -S python python-pip
Amazon Linuxyumsudo yum install python3
🌐
Python
docs.python.org › 3 › installing › index.html
Installing Python Modules — Python 3.14.3 documentation
py -2 -m pip install SomePackage ... # specifically Python 3.4 · On Linux systems, a Python installation will typically be included as part of the distribution....
🌐
The Hitchhiker's Guide to Python
docs.python-guide.org › starting › install3 › linux
Installing Python 3 on Linux — The Hitchhiker's Guide to Python
$ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt-get update $ sudo apt-get install python3.8 · If you are using other Linux distribution, chances are you already have Python 3 pre-installed ...
Discussions

Installing python on Linux - help?
You should stick with your distros version and only do a manual installation if not possible otherwise. If you really need to do it, have a look here: https://aruljohn.com/blog/install-python-debian/ More on reddit.com
🌐 r/learnpython
16
8
May 26, 2024
Getting started with Python development on a linux-system
There's no need to deal with all this stuff when you're just getting started. Just install Python, then create a folder where you want to keep your projects, then create a file __main__.py in the project directory and do your stuff there. You don't need virtual environments to get started with coding and stuff. You can learn about it later when you get the basics done. Use VS Code Editor. Once you get the basics done, then you may try asdf to manage multiple Python versions and use Poetry for virtual environment management. More on reddit.com
🌐 r/linuxquestions
11
0
January 23, 2024
How do I install python 2.7
You don't. Nobody ships it anymore. It's unmaintained and is a security risk. Find an alternative in Python 3 or another language. There are libraries and tools to convert to Python 3, use those. Become a better Python programmer and do it yourself. Otherwise you can install a VM of an old Linux release like Ubuntu 18.04 and try it there. Keep it off the internet and away from your personal files. More on reddit.com
🌐 r/linuxquestions
21
0
November 23, 2023
How does one install Python 3.7 in HPC without root access on Linux?
On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge. If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options: Limiting your involvement with Reddit, or Temporarily refraining from using Reddit Cancelling your subscription of Reddit Premium as a way to voice your protest. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/learnprogramming
4
1
July 27, 2023
🌐
Python Developer's Guide
devguide.python.org › getting-started › setup-building
Setup and building
For an optimized build of Python, use configure --enable-optimizations --with-lto. This sets the default make targets up to enable Profile Guided Optimization (PGO) and may be used to auto-enable Link Time Optimization (LTO) on some platforms. See --enable-optimizations and --with-lto to learn more about these options. ... If you are using the Windows Subsystem for Linux (WSL), clone the repository from a native Windows shell program like PowerShell or the cmd.exe command prompt, and use a build of Git targeted for Windows, for example, the Git for Windows download from the official Git website.
🌐
Python Land
python.land › home › install python: detailed instructions for window, mac, and linux
Install Python: Detailed Instructions for Window, Mac, and Linux • Python Land Tutorial
October 1, 2024 - Learn how to install Python on Windows, MacOS, and Linux. We show you multiple installation options, so you can choose what suits you best.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to install python 3 on ubuntu
How to Install Python 3 on Ubuntu | phoenixNAP KB
June 12, 2025 - Follow our step-by-step installation guide and install Python 3 on Ubuntu using APT, PPA, or from the source code.
🌐
Python
python.org › downloads
Download Python | Python.org
Or get the standalone installer for Python 3.14.3 · Download Python 3.14.3 · Download Python 3.14.3 · Looking for Python with a different OS? Python for Windows, Linux/Unix, macOS, Android, other · Want to help test development versions of Python 3.15? Pre-releases, Docker images ·
Find elsewhere
🌐
DEV Community
dev.to › motanga › how-to-install-python-on-linux-156p
How to Install Python on Linux - DEV Community
February 5, 2026 - The following command Installs pip for managing Python packages and dependencies. sudo apt install python3-pip · Verify pip Installation using the following command; pip3 --version ...
🌐
Liquid Web
liquidweb.com › home › how to install python on linux (almalinux)
How to Install Python on Linux (AlmaLinux) | Liquid Web
April 4, 2025 - With the help of this post, learn how to install Python on Linux (AlmaLinux). Python is one of the most popular programming languages for web applications.
🌐
Easierdocs
easierdocs.com › tutorials › python › install › linux-install
Install Python on Linux
February 2, 2026 - Python comes pre-installed on most Linux distributions, but you might want to install a newer version or use a version manager for better control. Using Package Manager Ubuntu/Debian sudo apt update sudo apt install python3 python3-pip python3-venv Fedora/RHEL sudo dnf install python3 python3-pip python3-venv Arch Linux sudo pacman -S python python-pip Using Pyenv (Recommended for Developers) Pyenv lets you easily switch between Python versions.
🌐
Kinsta®
kinsta.com › home › resource center › blog › python › how to install python on windows, macos, and linux
How To Install Python on Windows, macOS, and Linux - Kinsta®
November 17, 2025 - The Package Manager will download and install the latest version of Python 3 available in the repositories. Go to the Python website and download the newest version of Python for Linux from their website.
🌐
Alessioligabue
alessioligabue.it › en › blog › install-python-complete-guide
Complete Guide to Installing Python on Linux (2026)
January 29, 2026 - Complete guide to installing and upgrading Python on Linux. Learn how to manage multiple versions with pyenv, use virtual environments, and install pip
Address   13 Via Ca Marastoni, 42122, Reggio Emilia
🌐
GitHub
gist.github.com › MichaelCurrin › 57d70f6aaba1b2b9f8a834ca5dd19a59
Install Python on Linux distros · GitHub
Install using apt-get. sh $ sudo apt-get update $ sudo apt-get install python3 # OR python3.12
🌐
Rensselaer Polytechnic Institute
cs.rpi.edu › academics › courses › spring16 › cs1 › python_environment › linux_install.html
Install Python On Linux — Computer Science 1 - Spring 2016 1.0 documentation
$sudo apt-get install python-nose libjpeg62 libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev python-imaging python-sphinx python-oauth2 python-tk python-imaging-tk imagemagick
🌐
Reddit
reddit.com › r/learnpython › installing python on linux - help?
r/learnpython on Reddit: Installing python on Linux - help?
May 26, 2024 -

I am a long-time user of Python but I have never understood how to install python "properly" - I tend to figure out some way to get it done when I need to, and then forget all about it. But I want to understand it a bit better because it isn't straightforward in my opinion. I am not considering Pyenv or other such "helper" tools/dependencies - I want to learn how to do this the "official" way. I've looked at the official docs but can't see what I've done incorrectly. The main issue is that at some stage I often find myself wanting a newer version of python than what is provided, and then I end up a bit stuck.

I installed Debian and it came with python3 under my /usr/local/bin directory. There is also a Python installation under /usr/bin/python3.11, which I guess is my system python? I believe I was always interacting with my /usr/local/bin python - not the system python, so that's good. (Also I'm always using virtual environments, so let's not discuss their importance please). That was working fine for me, but now I want to upgrade my version of python and I am facing difficulties.

  • What should I do to upgrade python in an "official" way (i.e. not adding dev repositories like deadsnakes, not using helper tools like Pyenv)?

  • What do I need to do with pip? Currently, the pip command actually points to /usr/bin/python - i have to use pip3* (see below).

  • Can I simply delete the old python and pip versions from /usr/local/bin if I wanted to?

  • How do I ensure that every time I type python3 in the terminal, it grabs the latest one? Do I just ensure it is higher up in my PATH variable?

  • Why is there not one simple way to do this? Obviously everyone has slightly different needs, but I imagine 80% of python users just want to use python and have a reasonable way to upgrade when required without screwing something up in their system.

To explain why I'm asking this now, I installed the python source from the main website yesterday and tried to get it working but something is off. Here's what I did

  • Extracted the Python-3.12.3.tar.xz

  • Moved into the dir and ran ./configure --enable-optimizations --with-ensurepip=install

  • Ran make

  • Ran sudo make install

This worked, but I notice when I run python in the terminal REPL that I can't use the up/down keys to cycle through my command history:

>>> print("hello")
hello
>>> ^[[A

*Also, I notice that I now have pip (/usr/bin/python), pip3, and pip3.12 now, and I am confused about that. Should I alias pip with pip3.12 to prevent interacting with the system python? Should I just delete pip3 and make sure pip3 points to pip3.12?

These issues have convinced me that I've now installed python incorrectly somehow. I found some info about readline but that's deprecated, and I am starting to go down the rabbit hole of running random commands to try and fix things, which is probably going to make things worse.

🌐
Red Hat
redhat.com › en › blog › install-python-pip-linux
Install Python pip on Linux
November 21, 2025 - You can use pip for quick installs of useful Python utilities. For instance, yamllint is a must-have command for anyone writing YAML files, whether for Kubernetes or Ansible or just for arbitrary config files.
🌐
NumPy
numpy.org › install
NumPy - Installing NumPy
conda create -n my-env conda activate my-env conda install numpy ... python -m venv my-env source my-env/bin/activate # macOS/Linux my-env\Scripts\activate # Windows pip install numpy
🌐
Opensource.com
opensource.com › article › 20 › 4 › install-python-linux
How to install Python on Linux | Opensource.com
April 13, 2020 - Step-by-step instructions for installing the latest Python instead of (or alongside) an older version on Linux.
🌐
Quora
quora.com › How-do-I-Install-Python-on-Linux
How to Install Python on Linux - Quora
Answer (1 of 4): For Ubuntu and related distros you could actually download an already compiled variant of Python. Try the other (binary) installers before getting the source. As the other answer asks, what is your distro? Also for compiling, what errors does the ./configure step give?