UP | HOME
Sachin Patil

Sachin Patil

Free Software Developer | GNU Emacs Hacker

Python 3.x on RHEL7
Published on Oct 09, 2016 by Sachin.

Manually install Python-3.5 in Red Hat Enterprise Linux

Install required dependencies

1: yum install zlib-devel openssl-devel readline \
2:     readline-devel sqlite-devel tkinter ncurses-static \
3:     ncurses-base ncurses-term -y

Download, Configure, & Install Python

Download and extract the tarball

1: wget --progress=bar https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz
2: 
3: # Extract tarball
4: tar xvJf Python-3.5.2.tar.xz

Configure and install

1: cd Python-3.5.2
2: ./configure --prefix=/usr/local
3: 
4: # make [-jX], where X is number of jobs.
5: # This can be less-than or equal to number
6: # of cpu-cores
7: make -j4
8: make install

Sample tailed output

 1: Collecting setuptools
 2: Collecting pip
 3: Installing collected packages: setuptools, pip
 4: Found existing installation: setuptools 18.2
 5: Uninstalling setuptools-18.2:
 6:   Successfully uninstalled setuptools-18.2
 7: Found existing installation: pip 7.1.2
 8: Uninstalling pip-7.1.2:
 9:   Successfully uninstalled pip-7.1.2
10: Successfully installed pip-8.1.1 setuptools-20.10.1

You should have successfully installed Python-3.5.2 by now.

1: which python3.5
2: #  Output
3: /usr/local/bin/python3.5

[Optional] Create virtual environment

You can go head and try creating Python virtual environment using pyenv.

1: pyvenv py3
2: source py3/bin/activate

Once inside the virtual environment, verify Python version

1: (py3) [jedi@pywar ~]$ python --version
2: Python 3.5.2