How to install Python 3.6 on CentOS 7 (AWS, GCP)



Hello Friends,

Today, we are going to install Python 3.6 on RHEL Distribution (RHEL/CentOS)

In AWS EC2 default Python comes with instance are 2.7.5. So here we will install Python version3.6.0.

Step 1. There are some Pre-Requisites for this, here we will resolve that one by one.

Install the development, zlib-devel,openssl-devel


sudo yum -y groupinstall development
sudo yum -y install zlib-devel
sudo yum -y install openssl-devel

Install the PIP
curl -O https://bootstrap.pypa.io/get-pip.py

Use python to install pip
python get-pip.py

Step 2. After installed all the Pre-Requisite, here we need to  install OpenSSL also to avoid the errors.

Download the package OpenSSL_1_0_2l, extract, configure and finally clean unnecessary files and folder
wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_2l.tar.gz
tar -zxvf OpenSSL_1_0_2l.tar.gz

cd openssl-OpenSSL_1_0_2l/
./config shared
make
sudo make install

export LD_LIBRARY_PATH=/usr/local/ssl/lib/
cd ..
rm OpenSSL_1_0_2l.tar.gz
rm -rf openssl-OpenSSL_1_0_2l/


Step 3. Here we will download, install and configure Python3


Download the Python 3.6.0 package, extract, configure and finally clean unnecessary files and folder
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
tar xJf Python-3.6.0.tar.xz
cd Python-3.6.0
./configure
make
sudo make install
cd ..
rm Python-3.6.0.tar.xz
sudo rm -rf Python-3.6.0


Step 4. Now we create virtualenv running Python 3.6
sudo pip install --upgrade virtualenv
virtualenv -p python3 MYVENV
source MYVENV/bin/activate
python --version
# Python 3.6.0

Source: Github

Popular posts from this blog

WordPress Themes and Plugins Installation Problem

How to Convert PEM KeyFile into PPK KeyFile and vice versa?

How to SSH EC2 instance with ssh-agent along with SSH agent forwarding to SSH private instances in VPC?