Python is a general-purpose, high-level programming language used by developers around the world. PIP is a package manager for Python used for installing and managing additional packages. PIP allows you to manage full lists of packages and their corresponding version numbers. PIP provides a way to install user-defined projects locally with the use of a setup.py file.
In this post, we will explain how to install and use PIP on Rocky Linux. This procedure is compatible with Rocky Linux 8 and Rocky Linux 9.
Step 1 – Install PIP on Rocky Linux
Before installing PIP, you will need to install Python on your system. You can install it by running the following command:
dnf install python39 -y
Once Python is installed, you can verify the Python version using the following command:
python3.9 --version
You should get the following output:
Python 3.9.2
Next, install PIP using the following command:
dnf install python3.9-pip
Once PIP is installed, verify the installed version of PIP using the following command:
pip3 --version
You should see the following output:
pip 20.2.4 from /usr/lib/python3.9/site-packages/pip (python 3.9)
Step 2 – How to Update PIP
It is recommended to update PIP to the latest version. You can update it using the following command:
pip3 install --upgrade pip
You should see the following output:
Collecting pip Downloading pip-21.3.1-py3-none-any.whl (1.7 MB) |████████████████████████████████| 1.7 MB 1.9 MB/s Installing collected packages: pip Successfully installed pip-21.3.1
You can now verify the PIP version using the following command:
pip3 --version
You should see the following output:
pip 21.3.1 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
Step 3 – How to Use PIP
You can list all important options available with PIP using the following command:
pip3 --help
You should see the following output:
Usage: pip3[options] Commands: install Install packages. download Download packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. list List installed packages. show Show information about installed packages. check Verify installed packages have compatible dependencies. config Manage local and global configuration. search Search PyPI for packages. cache Inspect and manage pip's wheel cache. wheel Build wheels from your requirements. hash Compute hashes of package archives. completion A helper command used for command completion. debug Show information useful for debugging. help Show help for commands.
To install a specific package, run the following command:
pip3 install wheel
To get detailed information about a package, run the following command:
pip3 show wheel
You will get the following output:
Name: wheel Version: 0.37.0 Summary: A built-package format for Python Home-page: https://github.com/pypa/wheel Author: Daniel Holth Author-email: [email protected] License: MIT Location: /usr/local/lib/python3.9/site-packages Requires: Required-by:
To list all installed packages, run the following command:
pip3 list
You should see the following output:
Package Version ---------- ------- pip 21.3.1 setuptools 50.3.2 wheel 0.37.0
To list all outdated packages, run the following command:
pip3 list --outdated
You should see the following output:
Package Version Latest Type ---------- ------- ------ ----- setuptools 50.3.2 58.5.3 wheel
To uninstall a specific package, run the following command:
pip3 uninstall wheel
Conclusion
In the above post, you learned how to install and use PIP on Rocky Linux 8. You also learned how to manage Python packages with PIP. You can now easily use PIP to manage the Python dependencies. Get started with VPS hosting from Atlantic.Net!