Wednesday, March 18, 2020

Installation of Python 3 in Linux

Beliefs

As our belief, every Linux flavor has Python as one of the Shell. but that shell was created long back based on the OS release time repositories. In the most common situation where built-in Python might be at Python 2.7.x version but the latest version is on Python 3.7.x. The big challenge here is 'how do I upgrade or install Python3 on Linux?' So I've chased this challenge and completed the latest version installed on my Oracle Linux box.

Python 3 installation on RHELflavors




How do I install Python3 latest version on Linux?

Python Programming is simple and kids can learn by doing! It's capabilities to interact with machine internals and the simple structure makes easy to write and understand it. The latest Python version for download you can find from the Python official site.

Here I'm installing Python3 on the Oracle Linux same steps will be followed on any RHEL flavors as well.
yum -y groupinstall development
yum -y install zlib-devel

Note: If you are working behind a proxy then enable them by exporting the HTTP, HTTPS proxy environment variables.

wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz

#Extract the downloaded file
tar xJf Python-3.7.3.tar.xz

cd Python-3.7.3
./configure
or 
./configure --enable-optimizations # if you want stable optimizations
make
make install

This binary installation might take a few minutes, you can relax and then resume back to check the installation is showing python3. Remember this, When you run the make command it will build the Python3 installer by compiling it with a local 'gcc' compiler because Python libraries and dependencies are written in C and C++.

Good References links:

  1. Python Source installation
  2. Python FTP link

No comments:

Post a Comment

DevOps Foundation course

DevOps Foundation course
Join us to learn DevOps from the Beginning