Installing from RPM is generally better, because:

  • you can install and uninstall (properly) python3.
  • the installation time is way faster. If you work in a cloud environment with multiple VMs, compiling python3 on each VMs is not acceptable.

Solution 1: Red Hat & EPEL repositories

Red Hat has added through the EPEL repository:

  • Python 3.4 for CentOS 6
  • Python 3.6 for CentOS 7

[EPEL] How to install Python 3.4 on CentOS 6

sudo yum install -y epel-release
sudo yum install -y python34

# Install pip3
sudo yum install -y python34-setuptools  # install easy_install-3.4
sudo easy_install-3.4 pip

You can create your virtualenv using pyvenv:

pyvenv /tmp/foo

[EPEL] How to install Python 3.6 on CentOS 7

With CentOS7, pip3.6 is provided as a package :)

sudo yum install -y epel-release
sudo yum install -y python36 python36-pip

You can create your virtualenv using pyvenv:

python3.6 -m venv /tmp/foo

If you use the pyvenv script, you'll get a WARNING:

$ pyvenv-3.6 /tmp/foo
WARNING: the pyenv script is deprecated in favour of `python3.6 -m venv`

Solution 2: IUS Community repositories

The IUS Community provides some up-to-date packages for RHEL & CentOS. The guys behind are from Rackspace, so I think that they are quite trustworthy...

https://ius.io/

Check the right repo for you here:

https://ius.io/setup

[IUS] How to install Python 3.6 on CentOS 6

sudo yum install -y https://repo.ius.io/ius-release-el6.rpm
sudo yum install -y python36u python36u-pip

You can create your virtualenv using pyvenv:

python3.6 -m venv /tmp/foo

[IUS] How to install Python 3.6 on CentOS 7

sudo yum install -y https://repo.ius.io/ius-release-el7.rpm
sudo yum install -y python36u python36u-pip

You can create your virtualenv using pyvenv:

python3.6 -m venv /tmp/foo
Answer from Samuel Phan on Stack Overflow
🌐
Readthedocs
fire-insights.readthedocs.io › en › latest › installation › python-install-linux.html
Python Installation on Linux - Redhat/CentOS — Sparkflows 0.0.1 documentation
Some References for Installing Python: CentOS : https://tecadmin.net/install-python-3-7-on-centos/ Python installation requires the GCC compiler to be available on the machine. Use the following command to install the prerequisites for installing Python. yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel ·
🌐
Liquid Web
liquidweb.com › home › how to install python 3 on centos 7
Install Python 3 on CentOS 7: Easy Steps for Linux Users | Liquid Web
April 7, 2025 - Upgrade your CentOS 7 server to Python 3 with ease using our step-by-step guide featuring Yum and install Python3 Linux instructions.
Top answer
1 of 16
257

Installing from RPM is generally better, because:

  • you can install and uninstall (properly) python3.
  • the installation time is way faster. If you work in a cloud environment with multiple VMs, compiling python3 on each VMs is not acceptable.

Solution 1: Red Hat & EPEL repositories

Red Hat has added through the EPEL repository:

  • Python 3.4 for CentOS 6
  • Python 3.6 for CentOS 7

[EPEL] How to install Python 3.4 on CentOS 6

sudo yum install -y epel-release
sudo yum install -y python34

# Install pip3
sudo yum install -y python34-setuptools  # install easy_install-3.4
sudo easy_install-3.4 pip

You can create your virtualenv using pyvenv:

pyvenv /tmp/foo

[EPEL] How to install Python 3.6 on CentOS 7

With CentOS7, pip3.6 is provided as a package :)

sudo yum install -y epel-release
sudo yum install -y python36 python36-pip

You can create your virtualenv using pyvenv:

python3.6 -m venv /tmp/foo

If you use the pyvenv script, you'll get a WARNING:

$ pyvenv-3.6 /tmp/foo
WARNING: the pyenv script is deprecated in favour of `python3.6 -m venv`

Solution 2: IUS Community repositories

The IUS Community provides some up-to-date packages for RHEL & CentOS. The guys behind are from Rackspace, so I think that they are quite trustworthy...

https://ius.io/

Check the right repo for you here:

https://ius.io/setup

[IUS] How to install Python 3.6 on CentOS 6

sudo yum install -y https://repo.ius.io/ius-release-el6.rpm
sudo yum install -y python36u python36u-pip

You can create your virtualenv using pyvenv:

python3.6 -m venv /tmp/foo

[IUS] How to install Python 3.6 on CentOS 7

sudo yum install -y https://repo.ius.io/ius-release-el7.rpm
sudo yum install -y python36u python36u-pip

You can create your virtualenv using pyvenv:

python3.6 -m venv /tmp/foo
2 of 16
207

It is easy to install python manually (i.e. build from source):

  1. Download (there may be newer releases on Python.org):

     $ wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz
    
  2. Unzip

     $ tar xf Python-3.* 
     $ cd Python-3.*
    
  3. Prepare compilation

     $ ./configure
    
  4. Build

     $ make
    
  5. Install

     $ make install
    

    OR if you don't want to overwrite the python executable (safer, at least on some distros yum needs python to be 2.x, such as for RHEL6) - you can install python3.* as a concurrent instance to the system default with an altinstall:

     $ make altinstall
    

Now if you want an alternative installation directory, you can pass --prefix to the configurecommand.

Example: for 'installing' Python in /opt/local, just add --prefix=/opt/local.

After the make install step: In order to use your new Python installation, it could be, that you still have to add the [prefix]/bin to the $PATH and [prefix]/lib to the $LD_LIBRARY_PATH (depending of the --prefix you passed)

🌐
Serverspace
serverspace.io › support › help › install-python-centos
How to Install or Upgrade Python on CentOS 7/8 Stream: Build the Latest Python from Source
February 16, 2026 - Learn how to install or upgrade Python on CentOS 7 and CentOS 8 Stream. Step-by-step guide to building the latest Python version from source, installing dependencies, and safely updating Python on a server.
🌐
Reddit
reddit.com › r/centos › trying to install python3.9 on centos 7
r/CentOS on Reddit: Trying to install python3.9 on CentOS 7
October 19, 2022 -

I've tried a few didnt online guides but nothing seems to be helping me achieve what I'm looking for. I have a Linux machine for my network environment that I use for automation. I'm trying to upgrade my python 3.6.8 to some version of 3.9.x. I want to remove python 3.6.8, install 3.9, and then put 3.9 as the default for every user on the box.

Current Version of Linux 3.10.0-1160.6.1.el7.x86_64

I'm not a linux pro but I know some things.

🌐
GitHub
gist.github.com › wpupru › deda1cd96ea242d9a790e50cd0c97e9f
Install Python 3.7.0 on Centos 7 · GitHub
After installing these packages, you have to reinstall the version of python. It went well in my case. Hope it helps ... sudo su yum install -y wget gcc openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel ; cd /usr/src; wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz ; tar xzf Python-3.7.0.tgz ; cd Python-3.7.0 ; ./configure --enable-optimizations ; make altinstall ; rm -rf /usr/bin/python3 ; ln -s /usr/local/bin/python3.7 /usr/bin/python3 ; python3 -V uname -a
Find elsewhere
🌐
Medium
medium.com › @CurtisForrester › installing-python3-in-centos-7-6-offline-69d45ca48054
Installing Python3 in CentOS 7.6 Offline | by C.R.Forrester | Medium
August 1, 2019 - For this I simply spun up a Docker container based on CentOS 7.6. (https://hub.docker.com/_/centos). I then set it up with the necessary packages to build Python from source. Any CentOS 7.6 build environment will do. sh-4.2# yum install -y ...
🌐
AlexHost
alexhost.com › home › faq › comprehensive guide to installing python 3 on centos 7
Comprehensive Guide to Installing Python 3 on CentOS 7
October 7, 2024 - The EPEL repository contains additional packages, including Python 3, that are not found in standard CentOS repositories. With the EPEL repository enabled, choose your Python version: ... This command installs Python 3.6 along with `pip3`, the package manager for Python.
🌐
CrownCloud Wiki
wiki.crowncloud.net
CrownCloud Wiki - How To Install Python On CentOS Stream 10=
Python’s object-oriented approach helps developers write clear and logical code for both small and large-scale projects. ... Dependencies resolved. ================================================================== Package Arch Version Repository ================================================================== Installing: python3 x86_64 3.12.1-1.el10 appstream
🌐
Server Fault
serverfault.com › questions › 978812 › how-to-install-python3-using-yum-epel-release-on-centos7
linux - how-to install python3 using yum/epel-release on centos7 - Server Fault
Could you please advise how to install python36 using yum ? ... RHEL/CentOS 7 now includes python3 (version 3.6) in the base repositories.
Top answer
1 of 3
6

You should have taken the default available python3, that is the python3.6 package in centos7 that would have been easier to setup rather than compile an unsupported version. Suggest you install the supported python3 package in centos

Try doing yum install python36 from repository

sudo yum install -y https://repo.ius.io/ius-release-el7.rpm

Update yum package

 sudo yum update

Install python36 along with pip

sudo yum install -y python36u python36u-libs python36u-devel python36u-pip

Below steps are for python3.7, suggest avoiding unsupported packages. Alternate Steps for pip setup for Centos You need to install pip for python3.7 series Step 1: First install the EPEL Repository

sudo yum install epel-release

Step 2: Installing pip

python37 -m pip

Step 3: Verify if pip was installed properly pip --version

If the command not found error shows up, try

python37 -m ensurepip
2 of 3
1

I also as you said "followed these steps religiously from this link: https://tecadmin.net/install-python-3-7-on-centos/."

It was not an option for me to install python3.6, as I explicitly needed 3.7. I was able to install using the following procedure:

# AFAIK, libffi-devel solved the "ModuleNotFoundError: No module named '_ctypes'" I had when I tried installing without it. 
yum install libffi-devel 

cd /usr/src
wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz
tar xzf Python-3.7.5.tgz
cd Python-3.7.5
./configure --enable-optimizations
make install  # Or: make altinstall
python3 -V
pip3 --version
rm -f /usr/src/Python-3.7.5.tgz

What I changed from the referenced article is the version (3.7.5 instead of 3.7.4) and in addition installed "libffi-devel". It could be that this one would have solved on 3.7.4 as well.

🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-install-python-3-and-set-up-a-local-programming-environment-on-centos-7
How To Install Python 3 and Set Up a Local Programming Environment on CentOS 7 | DigitalOcean
April 20, 2017 - This tutorial will guide you through installing Python 3 on your local CentOS 7 machine and setting up a programming environment via the command line. Python…
🌐
MonoVM
monovm.com › blog › centos › how to install python 3 on centos 7?
How to Install Python 3 on CentOS 7?
January 15, 2024 - Follow these steps to Yum install Python 3.8 CentOS 7: 1- Update Package Repository: Ensure your system has the latest information about available packages. ... 2- Install Python 3: Use the following command to Install Python 3.6 CentOS 7, the ...
🌐
Zomro
zomro.com › blog › faq › 294-kak-ustanovit-python-310-na-centos-7
How to install Python 3.10 on CentOS 7 | Zomro
August 31, 2023 - sudo yum groupinstall "Development Tools" -y sudo yum install openssl-devel libffi-devel bzip2-devel -y ... Python modules extend the functionality of the language. The Python package manager (PIP) can be used to install them.
🌐
Medium
medium.com › @mrx04programmer › installing-any-updated-version-of-python-on-centos-7-8-or-arch-linux-563cabc8bb3c
Install any updated version python on centOS 7/8 | by mrx04programmer | Medium
August 16, 2023 - Install any updated version python on centOS 7/8 [Simple way] Example 3.8 1. Update System, installing wget and dependencies sudo yum -y update sudo yum -y install wget sudo yum install -y gcc …
🌐
Victordomingos
no-title.victordomingos.com › articles › 2020 › install_python_centos_linux › index.html
How to install the current Python version on CentOS Linux 7 | The No Title® Tech Blog
April 26, 2020 - Python misses something. You find out which development package provides that dependency. You install it using a package manager (for CentOS 7, it’s yum, but for other versions or other Linux distributions it could be dnf, apt-get or even other package managers).
🌐
GitHub
github.com › pyenv › pyenv
GitHub - pyenv/pyenv: Simple Python version management · GitHub
Running pyenv install -l gives the list of all available versions. ... NOTE: Most Pyenv-provided Python releases are source releases and are built from source as part of installation (that's why you need Python build dependencies preinstalled).
Starred by 44.9K users
Forked by 3.3K users
Languages   Shell 85.9% | Python 11.8% | Makefile 1.5% | C 0.3% | Roff 0.3% | Dockerfile 0.2%
🌐
TestingDocs
testingdocs.com › home › install python on centos
Install Python on CentOS - TestingDocs
December 19, 2024 - This tutorial will show you how to install Python on CentOS Linux using a few Terminal commands.