Install particular version of Python on CentOS 7
Prerequisites
- CentOS 7.x
- Root Access
You can install any of python version 3.x, download it from here
1. Installation set-up for Python3.7.0
we are installing python version 3.7.0.
Go to ‘/usr/src’ path
cd /usr/src
Download python version 3.7.0.
sudo wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
2. untar downloaded package
sudo tar -xvf Python-3.7.0.tar.xz
3. Installation of Python on CentOS
Go to ‘Python-3.7.0’ path
cd Python-3.7.0
Installation of gcc compiler and openssl-devel
sudo yum install gcc
sudo yum install openssl-devel
4. Configuration of python
sudo ./configure --prefix=/opt/python3
sudo make altinstall
sudo ln -s /opt/python3/bin/python3.7 /usr/bin/python3.7
5. Check installation
python3.7 --version
The output from CMD:
$ python3.7 --version
Python 3.7.0