Python 3.x on RHEL7
By Sachin
October 9, 2016
Manually install Python-3.5 in Red Hat Enterprise Linux
Install required dependencies
1
2
3
yum install zlib-devel openssl-devel readline \
readline-devel sqlite-devel tkinter ncurses-static \
ncurses-base ncurses-term -y
Download, Configure, & Install Python
Download and extract the tarball
1
2
3
4
wget --progress=bar https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz
# Extract tarball
tar xvJf Python-3.5.2.tar.xz
Configure and install
1
2
3
4
5
6
7
8
cd Python-3.5.2
./configure --prefix=/usr/local
# make [-jX], where X is number of jobs.
# This can be less-than or equal to number
# of cpu-cores
make -j4
make install
Sample tailed output
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Found existing installation: setuptools 18.2
Uninstalling setuptools-18.2:
Successfully uninstalled setuptools-18.2
Found existing installation: pip 7.1.2
Uninstalling pip-7.1.2:
Successfully uninstalled pip-7.1.2
Successfully installed pip-8.1.1 setuptools-20.10.1
You should have successfully installed Python-3.5.2 by now.
1
2
3
which python3.5
# Output
/usr/local/bin/python3.5
[Optional] Create virtual environment
You can go head and try creating Python virtual environment using pyenv.
1
2
pyvenv py3
source py3/bin/activate
Once inside the virtual environment, verify Python version
1
2
(py3) [jedi@pywar ~]$ python --version
Python 3.5.2