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
🌐
PhoenixNAP
phoenixnap.com › home › kb › devops and development › how to install latest version of python 3 on centos 7
How to Install Latest Version Of Python 3 on CentOS 7
November 10, 2022 - Then, update the repository: sudo ... 3. Install Python 3 by running the following command in the terminal window: sudo yum install -y python3 ·...
🌐
Centmin Mod
community.centminmod.com › threads › custom-python-3-7-3-8-3-9-3-10-rpm-builds-for-centos-7.22456
CentOS 7.x - Custom Python 3.7, 3.8, 3.9 & 3.10 RPM Builds For CentOS 7 | Centmin Mod Community Support Forums
February 5, 2022 - CentOS 7 by default uses Python 2.7 and has side by side install support up to Python 3.6 via YUM repository RPM packages. For Python 3.7 and higher,...
Discussions

python - How to install pip specifically for Python3 on CentOS 7? - Stack Overflow
Nevertheless i did it and it gives ...n/python3.7: No module named pip . 2019-03-15T18:08:20.537Z+00:00 ... Thanks. Installing Python3.6 worked liked a charm with pip. 2019-03-15T18:14:19.397Z+00:00 ... Also sometimes python devel issue comes where we have to run yum install python-devel before running the above commands. 2019-11-18T09:53:36.957Z+00:00 ... For CentOS 6 Use : yum install https://repo.ius.io/ius-release-el6.rpm ... More on stackoverflow.com
🌐 stackoverflow.com
Trying to install python3.9 on CentOS 7
Just curious, why are you sticking with CentOS 7 instead of upgrading to CentOS Stream 9, Rocky Linux 9, RedHat EL 9 or Alma 9? More on reddit.com
🌐 r/CentOS
7
10
October 19, 2022
Cleanest way to install Python 3.7 on CentOS 7 image
Have you considered usinh the official Python 3.7 Docker image ? More on reddit.com
🌐 r/docker
7
1
July 10, 2019
Python Versions on CentOs 7
Going to iuscommunty is unnecessary. CentOS 7.7 includes a python3 package in the base repository Regardless it sounds like you installed pip3 from an RPM then tried to update it natively? Don’t do that (with anything), you’re bound to just make a mess as other packages depend on having a certain version installed. I use pip only as a last resort; in general I try to find RPMs for the Python packages I want, mostly from CentOS repositories or EPEL. More on reddit.com
🌐 r/CentOS
15
2
December 23, 2019
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)

🌐
CyberITHub
cyberithub.com › install-python3
How to install Python3 on CentOS 7 | CyberITHub
October 9, 2019 - [root@localhost ~]# yum install python3 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.excellmedia.net * extras: centos.excellmedia.net * updates: centos.excellmedia.net Resolving Dependencies --> Running ...
🌐
Quora
quora.com › How-do-you-install-Python-3-on-a-Linux-server-using-RPM-Python-3-x-Linux-CentOS-7-RPM-Python-install-development
How to install Python 3 on a Linux server using RPM (Python 3.x, Linux, CentOS 7, RPM, Python install, development) - Quora
Answer: For CentOS 7.7: [code]yum update -y yum install -y python3 [/code]For CentOS 7 earlier than 7.7: [code]yum install yum-utils https://centos7.iuscommunity.org/ius-release.rpm -y yum makecache yum install python36u -y [/code]Sources: CentOS 7.7 install instructions from How to Install Py...
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.

Find elsewhere
🌐
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.
🌐
RPMfind
rpmfind.net › linux › rpm2html › search.php
RPM resource python3
This package supplies rich command line features provided by readline, and sqlite3 support for the interpreter core, thus forming a so called "extended" runtime. Installing "python3" is sufficient for the vast majority of usecases.
🌐
Vinod Pandey
vinodpandey.com › how-to-install-python3-on-centos-7
How to Install Python 3 on Centos 7 | Vinod Pandey
January 10, 2021 - In this tutorial we will install Python 3.6, 3.7, 3.8 & 3.9 on CentOS 7. The default python version in CentOS 7 is 2.7.5. If we forcefully upgrade or replace this version, yum and other utitiles may break causing the OS to become unstable. Instead of upgrading/replacing default python, we will install the new version of python using alternate install method. This setup will also install corresponding pip for each python version separately. ... python3.9 -V Python 3.9.1 pip3.9 -V pip 20.2.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9
🌐
DedicatedCore
dedicatedcore.com › home › how to install latest version of python 3.10 on centos 7
How to Install Latest Version of Python 3.10 on CentOS 7 - DedicatedCore Blog
May 29, 2025 - You must add IUS, a yum repository ... Use the following command to include the IUS repository: sudo yum install https://repo.ius.io/ius-release-el$(rpm -E '%{rhel}').rpm · Hold off until the installation is finished...
🌐
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…
🌐
AZDIGI
azdigi.com › home › blog › linux server › install python 3 and set it as the default on centos 7
Install Python 3 and set it as the default on Centos 7 with 5 steps
January 13, 2026 - yum install https://repo.ius.io/ius-release-el7.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm · Now install Python 3, I will install Python 3.6 with the command: AZDIGI Tutorial · yum -y install python36u · As ...
🌐
MonoVM
monovm.com › blog › centos › how to install python 3 on centos 7?
How to Install Python 3 on CentOS 7?
January 15, 2024 - sudo python3 -m pip install --upgrade pip setuptools · Note: When using this approach, you may need to manage updates and dependencies manually. The 'pip' package manager can be used to Install Python 3.10 CentOS 7 more packages.
🌐
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 - To access it, enable the EPEL (Extra Packages for Enterprise Linux) repository: ... The EPEL repository contains additional packages, including Python 3, that are not found in standard CentOS repositories.
🌐
My Tech Learnings
theleadcoder.wordpress.com › 2020 › 01 › 31 › install-python-3-in-centos-7-yum-issue-resolved
Install Python 3 in Centos 7 (Yum issue resolved) – My Tech Learnings
January 31, 2020 - There are many ways to install python3 in centos 7. I used below method to install python 3. sudo yum install https://centos7.iuscommunity.org/ius-release.rpm sudo yum install -y python36u python36u-libs python36u-devel python36u-pip Then we ...
🌐
Linux Hint
linuxhint.com › install_python3_centos7
Install Python 3 on CentOS 7 – Linux Hint
In this article, I will show you how to install Python 3.x, mainly Python 3.4, Python 3.5, Python 3.6 along with PIP for Python 3.4, Python 3.5, and Python 3.6 respectively on CentOS 7.
🌐
Linux Stans
linuxstans.com › how-to-install-python-centos
How to Install Python 3.10 (or 3.11) on CentOS - Linux Stans
January 24, 2022 - Detailed, beginner-friendly instructions on how to install Python 3.10 and Python 3.11 on CentOS 7 and CentOS 8.
🌐
GitHub
gist.github.com › wpupru › deda1cd96ea242d9a790e50cd0c97e9f
Install Python 3.7.0 on Centos 7 · GitHub
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