Python 3 Installation in Ubuntu
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt-get update
$ sudo apt-get install python3.8
$ python3 --version
Or
$ sudo apt-get install python3.6
$ python3 --version
Default Versions of Python in CentOS
Depending on when you’re reading this or what version you’re using, the version that you have installed by default or the version that’s available in the CentOS repo might be different.
For CentOS 7:
- Python 2.7.5 is installed by default. That version has reached its EOL years ago, so you should upgrade ASAP.
- Python 3.6.8 is the latest version available in the CentOS 7 repos. 3.6 reached its EOL in Dec 2021, so you should upgrade ASAP.
For CentOS 8:
- Python isn’t installed by default.
- Python 3.9.6 is the latest version available in the CentOS 8 repos. The EOL of Python 3.9.6 is Oct 2025, so you can use that version. To install it, just run
yum install python39
and that’s it. If you want to install Python 3.10 or 3.11, follow the tutorial below.
Python 3 Installation in Centos
$ sudo yum install yum-utils
$ sudo yum-builddep python3
$ python3 --version
Installing Python 3.6 on CentOS 7
sudo yum -y install wget make gcc openssl-devel bzip2-devel
cd /tmp/
wget https://www.python.org/ftp/python/3.6.12/Python-3.6.12.tgz
tar xzf Python-3.6.12.tgz
cd Python-3.6.12
./configure --enable-optimizations
sudo make altinstall
sudo ln -sfn /usr/local/bin/python3.6 /usr/bin/python3
sudo ln -sfn /usr/local/bin/python3.6 /usr/bin/python
sudo ln -sfn /usr/local/bin/pip3.6 /usr/bin/pip3
python3.6 -V
pip3.6 -V
$ sudo ln -fs /usr/local/bin/python3.6 /usr/bin/python
$ sudo ln -fs /usr/local/bin/python3.6 /usr/bin/python3
Installing Python 3.7 on CentOS 7
sudo yum -y install wget make gcc openssl-devel bzip2-devel
cd /tmp/
wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
tar xzf Python-3.7.9.tgz
cd Python-3.7.9
./configure --enable-optimizations
sudo make altinstall
sudo ln -sfn /usr/local/bin/python3.7 /usr/bin/python3.7
sudo ln -sfn /usr/local/bin/pip3.7 /usr/bin/pip3.7
python3.7 -V
pip3.7 -V
$ sudo ln -fs /usr/local/bin/python3.7 /usr/bin/python
$ sudo ln -fs /usr/local/bin/python3.7 /usr/bin/python3
Installing Python 3.8 on CentOS 7
sudo yum -y install wget make gcc openssl-devel bzip2-devel
cd /tmp/
wget https://www.python.org/ftp/python/3.8.7/Python-3.8.7.tgz
tar xzf Python-3.8.7.tgz
cd Python-3.8.7
./configure --enable-optimizations
sudo make altinstall
sudo ln -sfn /usr/local/bin/python3.8 /usr/bin/python3.8
sudo ln -sfn /usr/local/bin/pip3.8 /usr/bin/pip3.8
python3.8 -V
pip3.8 -V
$ sudo ln -fs /usr/local/bin/python3.8 /usr/bin/python
$ sudo ln -fs /usr/local/bin/python3.8 /usr/bin/python3
Installing Python 3.8 on CentOS 7
sudo yum -y install wget make gcc openssl-devel bzip2-devel
cd /tmp/
wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz
tar xzf Python-3.9.1.tgz
cd Python-3.9.1
./configure --enable-optimizations
sudo make altinstall
sudo ln -sfn /usr/local/bin/python3.9 /usr/bin/python3.9
sudo ln -sfn /usr/local/bin/pip3.9 /usr/bin/pip3.9
python3.9 -V
pip3.9 -V
$ sudo ln -fs /usr/local/bin/python3.9 /usr/bin/python
$ sudo ln -fs /usr/local/bin/python3.9 /usr/bin/python3
How to Install Python 3.10 on CentOS
yum update
yum install openssl-devel bzip2-devel libffi-devel
yum groupinstall “Development Tools”
wget https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tgz
tar -xzf Python-3.10.2.tgz
cd Python-3.10.2
./configure –enable-optimizations
make altinstall
python3.10 -V
$ sudo ln -fs /usr/local/bin/python3.10 /usr/bin/python
$ sudo ln -fs /usr/local/bin/python3.10 /usr/bin/python3
How to Install Python 3.10 on CentOS
yum update
yum install openssl-devel bzip2-devel libffi-devel
yum groupinstall “Development Tools”
wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0a4.tgz
tar -xzf Python-3.11.0a4.tgz
cd Python-3.11.0a4
./configure –enable-optimizations
make altinstall
python3.11 -V
$ sudo ln -fs /usr/local/bin/python3.11 /usr/bin/python
$ sudo ln -fs /usr/local/bin/python3.11 /usr/bin/python3
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND
Doesn’t work on CentOS 7.