How to Install Python 3.8 on RHEL 7 | Very easy method

How to Install Python 3.8 on RHEL 7

 

Python is very much popular and opensource programming language . It id widely used everywhere. Developers always ask for install latest version of python but sysadmins problem is that Redhat provides till only python 3.6 . This article cover how to install latest version of python or python 3.8 in RHEL 7 or RHEL 7.9.

In this article you will learn how to install python 3.8 on RHEL 7 without affecting your current environment. By this method you can install as many python version as required .

TIP : Use virtual environment for different version of python so it will not affect any python app too. 

Below Topics are cover in this article :

How to Install Python 3.8 on RHEL 7
How to Install Python 3.9 on RHEL 7
How to Install Python 3.10 on RHEL 7

 

Get Latest Version or required version of python

Go to site : https://www.python.org/ftp/python/

and copy link of python version according to your requirements . Here you will get all python version choose according to your requirements and developers ask.

Python Download

Python download 3.8.9

Install required rpm package

Install required packages in your RHEL 7 system which help to install python 3.8 version

$ sudo yum install -y gcc openssl-devel libffi-devel bzip2-devel wget

These packages help to download and install python3.8

Download Python

Download python in opt or tmp folder . Make sure your internet is working if not connect to wifi or if you are working on server connect with network team and update resolve.conf file with internet active dns server.

$ cd /opt
$ wget https://www.python.org/ftp/python/3.8.9/Python-3.8.9.tgz

$ tar xzvf Python-3.8.9.tgz

Compile and Install Python in System

Now enter the directory of extracted python and configure the code files according to your Linux environment.  We already know RHEL 7 previously installed python . So we run make altinstall . This will not harm your current environment. If you install by make install then it can effect your system environment and may you need to fix issues in other applications.

$ cd Python-3.8.9/
$ sudo ./configure --enable-optimizations
$ sudo make altinstall

This will take 2- 5 min to complete the full python3.8 installation. You can install different version of python with same way .

Related post :cpu-is-idle-but-load-average-is-still-high-solution-for-all-linux-environment

Check final result

Final result should not have any error exit code . If there is any exit code then even after it show that python3.8 is installed but it will not work correctly .This should be something similar to below result :

............

running install_scripts
copying build/scripts-3.8/pydoc3.8 -> /usr/local/bin
copying build/scripts-3.8/idle3.8 -> /usr/local/bin
copying build/scripts-3.8/2to3-3.8 -> /usr/local/bin
changing mode of /usr/local/bin/pydoc3.8 to 755
changing mode of /usr/local/bin/idle3.8 to 755
changing mode of /usr/local/bin/2to3-3.8 to 755
rm /usr/local/lib/python3.8/lib-dynload/_sysconfigdata__linux_x86_64-linux-gnu.py
rm -r /usr/local/lib/python3.8/lib-dynload/__pycache__
/bin/install -c -m 644 ./Misc/python.man \
/usr/local/share/man/man1/python3.8.1
if test "xupgrade" != "xno" ; then \
case upgrade in \
upgrade) ensurepip="--altinstall --upgrade" ;; \
install|*) ensurepip="--altinstall" ;; \
esac; \
./python -E -m ensurepip \
$ensurepip --root=/ ; \
fi
Looking in links: /tmp/tmpv86j4qpe
Processing /tmp/tmpv86j4qpe/setuptools-47.1.0-py3-none-any.whl
Processing /tmp/tmpv86j4qpe/pip-20.1.1-py2.py3-none-any.whl
Installing collected packages: setuptools, pip
WARNING: The script easy_install-3.8 is installed in '/usr/local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script pip3.8 is installed in '/usr/local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-20.1.1 setuptools-47.1.0

If your output is not same then try to check if current version is already installed or you have correct privileges .

 

Verify Python Version

This command altinstall will install separate python binary files in separate folder. So to check current version of python need to specify binary file .

$ python3.8 --version or python3.8 -V

 

Conclusion

Now you have successfully install python 3.8 in your RHEL7 environment without effecting any system application and function . Hope you like the article share with your Linux admin friends and group to show some support .

Leave a Comment

Your email address will not be published. Required fields are marked *