## Assumption: That you have access to the rhel-6-server-rpms repository either via RH subscription or via Red Hat satellite or via DVD
yum groupinstall -y "Development Tools"
yum install -y zlib-devel
## download the source
wget --no-check-certificate https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
## extract the source and change to the directory
tar xvf Python-3.6.8.tar.xz
cd Python-3.6.8
## assuming we want to install into /opt/local
./configure --prefix=/opt/local --with-ensurepip-install
## install files are in /opt/local/bin
[root@rhel6 ~]# ls -lah /opt/local/bin/
total 20M
drwxr-xr-x. 2 root root 4.0K Oct 26 11:52 .
drwxr-xr-x. 6 root root 4.0K Oct 26 11:52 ..
-rwxr-xr-x. 1 root root 101 Oct 26 11:52 2to3-3.6
-rwxr-xr-x. 1 root root 242 Oct 26 11:52 easy_install-3.6
-rwxr-xr-x. 1 root root 99 Oct 26 11:52 idle3.6
-rwxr-xr-x. 1 root root 224 Oct 26 11:52 pip3.6
-rwxr-xr-x. 1 root root 84 Oct 26 11:52 pydoc3.6
-rwxr-xr-x. 2 root root 9.6M Oct 26 11:51 python3.6
-rwxr-xr-x. 2 root root 9.6M Oct 26 11:51 python3.6m
-rwxr-xr-x. 1 root root 3.1K Oct 26 11:52 python3.6m-config
-rwxr-xr-x. 1 root root 441 Oct 26 11:52 pyvenv-3.6
## if necessary create softlink to /usr/bin
ln -s /opt/local/bin/python3.6 /usr/bin/python3
ln -s /opt/local/bin/pip3.6 /usr/bin/pip3
## Verify
[root@rhel6 ~]# which python3
/usr/bin/python3
[root@rhel6 ~]# which pip3
/usr/bin/pip3
[root@rhel6 ~]# python3 -V
Python 3.6.8
[root@rhel6 ~]# pip3 -V
pip 18.1 from /opt/local/lib/python3.6/site-packages/pip (python 3.6)
|