Installing pip on different Linux distributions involves varying commands and package managers. For distributions like Fedora, CentOS, and RHEL, you can use the dnf or yum package managers. On Arch Linux, you would use the pacman package manager.
In these systems, installing pip requires fetching the appropriate packages to ensure both Python and pip3 are available. The process is generally straightforward but varies slightly depending on the distribution and its version.
Properly installing pip is essential for managing Python packages effectively across different environments. This allows for easy installation, updates, and management of libraries using pip.
Steps to install pip on CentOS, Red Hat or Fedora:
- Open terminal application.
- Install pip package using dnf.
$ sudo dnf 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.
- 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:passwd@]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.
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Comment anonymously. Login not required.