How to Install Python in Linux RHEL 8/Oracle Linux 8

Introduction to Python

Python is a powerful and versatile programming language that has become increasingly popular in recent years. It is used for many applications including website development, data analysis, artificial intelligence and machine learning. Python provides developers with many advantages such as its readability, scalability and object-oriented design. It is also easy to learn and use, making it a great choice for beginners who want to get into coding quickly. The steps below show you how to install Python in Linux RHEL 8/Oracle Linux 8/CentOS 8 operating system.

Prerequisites.

Installing Python on your computer is a relatively easy process. However, there are certain prerequisites that must be met in order for the installation to be successful. Fix “Error: Unable to find a match: python” with below steps.

# dnf install python

Output :

Last metadata expiration check: 0:55:04 ago on Thu 12 Jan 2023 10:45:51 PM +08.
No match for argument: python
There are following alternatives for "python": python2, python36, python38, python39
Error: Unable to find a match: python

Solution : Need to specify specific python version as the following available alternatives.

1. How to install Python.

Do you want to run multiple versions of Python on your system? It’s a common requirement for developers and data scientists who need to work with different versions of the same package. With the right setup, you can easily manage multiple versions of Python on a single system. This guide will provide you with step-by-step instructions on how to do this, as well as tips and tricks for managing multiple versions of the same package in a single environment. In this case we install Python 3.9 then have to specify exact version python39″

# dnf install python39 -y

2. Verify if default python version properly configured :

# which python

Output :

/usr/bin/which: no python in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

3. Check python3 :

# which python3

Output :

/usr/bin/python3

4. Create a symlink for the directory. This will set the default python version into the system. In this case we will configure python 3.9 as the default :

# ln -s /usr/bin/python3 /usr/bin/python

5. Verify and check the version

# which python

Output :

/usr/bin/python

Command to check the python version :

# python -V

Output :

Python 3.9.13

Conclusion – Get Started with Python

Python is an incredibly powerful programming language that can be used to create a wide range of applications. With its easy-to-learn syntax, Python is the perfect language for beginners and experienced developers alike. Whether you’re looking to create a website or build an AI chatbot, Python has the tools and libraries to get you started. So don’t wait any longer – start coding with Python today!

Leave a Comment