To advertise with us contact on Whatsapp: +923041280395 For guest post email at:

How to Install Pip on CentOS 8

How to Install Pip on CentOS 8

Pip is a package management system that allows you to install, remove, and otherwise manage software packages written in Python. It can be used to install packages from the Python Package Index (PyPI) and other indexes.

In this tutorial, we will explain how to install pip for Python 2 and 3 on CentOS 8 and cover the basics of how to manage Python packages with pip.


  • You must be registered with Alibaba Cloud.
  • You must have added and verified your payment method.
  • If you are a new user, after payment method verification you can claim free $450 – $1300 credits. You can register new account and claim your free credits.
  • To setup up your ECS for the first time, you can refer to this tutorial or quick-start guide.
  • Domain registration is recommended for setting up FQDN hostname of your server. But if you are willing to use IP address directly, you may skip this.
  • If you have registered domain with any 3rd party, you may transfer into Alibaba Cloud.
  • If you are using the domain name, remember to point your domain name to IP address of your server.
  • You should set up your server’s hostname.
  • Access to VNC console in your Alibaba Cloud or SSH client installed in your PC.
  • Login as root user and create a user with sudo privileges.

Installing pip on CentOS 8

As you know, there are two Python versions that are being actively developed, Python 2 and Python 3. By default RHEL/CentOS 8 doesn’t have an unversioned system-wide python command to avoid locking the users to a specific version of Python. Instead, it gives the user a choice to install, configure, and run a specific Python version .

When installing python modules globally, you should prefer installing python modules from the distribution repositories using dnf or yum because they are tested to work properly on CentOS 8. Use pip to install python modules globally only if there is no rpm package for the python module.

The names of the Python 2 module packages are prefixed with “python2” and Python 3 modules with “python3”. For example, to install the paramiko module for Python 3, you would run:

$ sudo dnf install python3-paramiko

Installing pip for Python 3 (pip3)

To run Python 3, you need to type python3 explicitly, and to run pip type pip3.

Verify that the pip is installed correctly by running the following command which will print the pip version:

$ pip3 --version

The version number may vary, but it will should something like this:


pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

To be able to install and build Python modules with pip, you need to install the Development tools:

$ sudo yum install python3-devel
$ sudo yum groupinstall 'development tools'

Installing pip for Python 2 (pip2)

To install Python 2 and pip, enter the following command:

$ sudo dnf install python2

Verify the installation by typing:

$ pip2 --version

The output should look something like this:


Python 2.7.15

To execute Python 2, type python2, and to run pip type pip2.

Install Development tools:

$ sudo yum install python2-devel
$ sudo yum groupinstall 'development tools'

Managing Python Packages with pip

Typically, you should use pip inside a virtual environment only. Python Virtual Environments allows you to install Python modules in an isolated location for a specific project, rather than being installed globally. This way, you do not have to worry about affecting other Python projects.

In this section, we will go through several basic pip commands.

To install a python module with pip run pip install followed by the package name. For example, to install a package named twisted, you would run the following command:

$ pip install twisted

Note: twisted is an asynchronous networking framework written in Python.

If you want to install a specific version of the package, use the following format:


$ pip install twisted==19.10.0

To uninstall a package use pip uninstall followed by the package name:

$ pip uninstall package_name

To search packages from PyPI:

$ pip search "package_name"

Installed packages can be listed with:

$ pip list

List outdated packages:

$ pip list --outdated

To upgrade an already installed package to the latest version, use the following command:

$ pip3 install --upgrade package_name


We’ve shown you how to install pip on CentOS 8 and how to easily install and uninstall Python modules with pip.


Leave a Reply

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