Thursday, May 2, 2019

Oracle Linux 7 -- Install Python 3.7 from Source


You want to install Python 3.7 or latest version on Oracle Linux 7 or RHEL 7 platforms.



First make sure you have set up yum repositories to be able to download and install required packages.

Install required packages:

# yum install wget
# yum install gcc readline readline-devel
# yum install zlib zlib-devel
# yum install libffi-devel openssl-devel

Install optional packages:

# yum install tk tk-devel
# yum install sqlite sqlite-devel
# yum install bzip2 bzip2-devel
# yum install xz xz-devel
# yum install libuuid libuuid-devel
# yum install uuid

From the page, navigate to the Latest Python 3 Release page, and download the latest source code archive file, for example:

# wget

Extract the source code from the archive:

# tar -xf Python-3.7.3.tgz

Change directory to the source directory:

# cd Python-3.7.3

Run the commands to build and install Python 3:

# ./configure --enable-optimizations
# make
# make test
# make install

This should install python3:

# python3
Python 3.7.3 (default, May  2 2019, 21:00:48)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36.0.1)] on linux
Type "help", "copyright", "credits" or "license" for more information.


1 comment:

ujjwal said...

Thanks for the detailed steps.. However, after it is installed, I'm unable to run python.. It says command not found