Python modules for CentOS, Red Hat, or Fedora are available in their yum repositories, but they don't have as many as those hosted in Python Package Index (PyPI). PyPI modules are also generally more up-to-date.

PyPI modules can be installed using pip, but pip is not installed by default in CentOS, Red Hat, or Fedora. You can install pip using yum or dnf at the terminal.

Steps to install pip on CentOS / Red Hat / Fedora:

  1. Open terminal application.
  2. Install pip package using yum.

    $ sudo yum install --assumeyes python3-pip [sudo] password for user: CentOS-8 - AppStream                                 11 kB/s | 4.3 kB     00:00 CentOS-8 - Base                                     2.8 kB/s | 3.9 kB     00:01 CentOS-8 - Extras                                   3.8 kB/s | 1.5 kB     00:00 Dependencies resolved. ====================================================================================  Package             Arch    Version                               Repository  Size ==================================================================================== Installing:  python3-pip         noarch  9.0.3-15.el8                          AppStream   19 k Installing dependencies:  python36            x86_64  3.6.8-2.module_el8.1.0+245+c39af44f   AppStream   19 k  python3-setuptools  noarch  39.2.0-5.el8                          BaseOS     162 k  Transaction Summary ==================================================================================== Install  3 Packages  Total download size: 201 k Installed size: 466 k ##### snipped

    Install python2-pip package instead if you're installing for Python 2.x.

  3. Run pip command to test if installation was successful and to check installed version.

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

    Run pip2 if you've installed python2-pip package.

    More options for the command:

    $ pip3 --help  Usage:   pip <command> [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.   search                      Search PyPI for packages.   wheel                       Build wheels from your requirements.   hash                        Compute hashes of package archives.   completion                  A helper command used for command completion.   help                        Show help for commands.  General Options:   -h, --help                  Show help.   --isolated                  Run pip in an isolated mode, ignoring environment                               variables and user configuration.   -v, --verbose               Give more output. Option is additive, and can be                               used up to 3 times.   -V, --version               Show version and exit.   -q, --quiet                 Give less output. Option is additive, and can be                               used up to 3 times (corresponding to WARNING, ERROR,                               and CRITICAL logging levels).   --log <path>                Path to a verbose appending log.   --proxy <proxy>             Specify a proxy in the form                               [user:[email protected]]proxy.server:port.   --retries <retries>         Maximum number of retries each connection should                               attempt (default 5 times).   --timeout <sec>             Set the socket timeout (default 15 seconds).   --exists-action <action>    Default action when a path already exists: (s)witch,                               (i)gnore, (w)ipe, (b)ackup, (a)bort.   --trusted-host <hostname>   Mark this host as trusted, even though it does not                               have valid or any HTTPS.   --cert <path>               Path to alternate CA bundle.   --client-cert <path>        Path to SSL client certificate, a single file                               containing the private key and the certificate in                               PEM format.   --cache-dir <dir>           Store the cache data in <dir>.   --no-cache-dir              Disable the cache.   --disable-pip-version-check                               Don't periodically check PyPI to determine whether a                               new version of pip is available for download.                               Implied with --no-index.