Installing python3.6 on CENTOS 6.8
Installing the prerequisite package to build python from source
yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel
# below is optional:
yum -y install sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
Download the python source
wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
tar xfvz Python-3.6.3.tgz
cd Python-3.6.3
Compiling and install the python from source code
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall
ln -s /usr/local/bin/python3.6 /usr/bin/python3.6
ln -s /usr/local/bin/python3.6 /usr/bin/python3
Download and install pip
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
ln -s /usr/local/bin/pip3.6 /usr/bin/pip3
Python3.6 and Pip3 is ready now
[root@iZm5eah3mqbzffv5h0fremZ Python-3.6.3]# python3 -V
Python 3.6.3
[root@iZm5eah3mqbzffv5h0fremZ Python-3.6.3]# pip3 -V
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)