PIP is a CLI tool to simplify the installation, upgrade, and removal of Python packages from PyPI (Python Package Index). Therefore, PIP offers a convenient way to include external libraries in Python projects which makes the sharing and reusing of code simple. If you also want to install PIP on your system, this tutorial is for you. Here, we will explain the ways to install and use the Python PIP on Rocky Linux 9 (RHEL-based OS).
How to Install and Use the Python PIP on Rocky Linux 9
Make sure that you have the Python installed before installing Python PIP. If you haven’t installed it yet, run the following command to install it:
You can check whether Python is successfully installed or is already present on your system by checking its version. To do this, use the following command:
You are now ready to install the Python PIP on Rocky Linux 9.
Install through the Repository
Python PIP is available in the repositories of almost all Linux distros. The repository contains it, so you can directly install it from there. For this, update the repository first using the following command:
As you can see, the installed Python version in our system is 3.9. To install the Python PIP, let’s execute the following command:
Thus, Python PIP has been successfully installed in your Rocky Linux. Check its version to verify that it is installed:
Install through the Script
Sometimes, the latest or updated version of Python PIP may not be installed through the repository. As you can see, its 21.1 version has been installed through the previous method.
Through the script, you can install the updated version of Python PIP. For this, download the script first with the help of the wget or curl command as follows:
Now, install the Python PIP with the help of the following command:
Then, check the version of Python PIP with the following command:
Now, you can see that its version is 23.1 which is its updated version.
The Use of Python PIP on Rocky Linux 9
The general syntax to use the Python PIP is as follows:
Install a Package
In this example, we install the debug package through it, providing useful information about debugging.
Get the Detailed Information about a Specific Package
Run the following command to know the details of any installed package:
Upgrade a Package
Similarly, to upgrade any installed package with the help of Python PIP, run the following command in the terminal:
List All Installed Packages
The following command lists all Python PIP packages:
Uninstall a Package
A specific package can also be uninstalled using the following command:
List All Outdated Packages
You can list all the outdated packages by executing the following command:
Apart from this, you can explore the Python PIP options with the help of the following command:
This is how you can use the Python PIP through various options.
Conclusion
This is all about the approaches that you can try to install and use Python on Rocky Linux 9 without trouble. We included multiple examples to explain the usage of Python PIP. We recommend you to download the correct package from the official website. Otherwise, you may face an error while installing the RPM package.