How To Install PIP (to Manage Python Packages) in Linux
How To Install PIP (to Manage Python Packages) in Linux
How To Install PIP (to Manage Python Packages) in Linux |
Pip is a package management system that simplifies installation and management of software packages written in Python such as those found in the Python Package Index (PyPI). In this article, we will explain how to install PIP on Linux .
Install PIP in Linux Systems
To install pip in Linux, run the appropriate command for your distribution as follows:
Install PIP On Debian/Ubuntu
# apt install python-pip #python 2
# apt install python3-pip #python 3
# apt install python3-pip #python 3
Install PIP On CentOS and RHEL
# yum install epel-release
# yum install python-pip
# yum install python-pip
Install PIP on Fedora
# dnf install python-pip #Python 2
# dnf install python3 #Python 3
# dnf install python3 #Python 3
Install PIP on Arch Linux
# pacman -S python2-pip #Python 2
# pacman -S python-pip #Python 3
# pacman -S python-pip #Python 3
Install PIP on openSUSE
# zypper install python-pip #Python 2
# zypper install python3-pip #Python 3
# zypper install python3-pip #Python 3
How to Use PIP in Linux Systems
To install, uninstall or search new packages, use these commands.# pip install packageName
# pip uninstall packageName
# pip search packageName
To see a list of all commands type:
# pip help
Sample Output
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.
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.
Verify Pip installation
pip --version
[root@exampleserver ~]# pip --version
pip 20.0.2 from /usr/lib/python2.7/site-packages/pip (python 2.7)
[root@exampleserver ~]#
pip 20.0.2 from /usr/lib/python2.7/site-packages/pip (python 2.7)
[root@exampleserver ~]#
Install a package
pip install package_name
[root@exampleserver ~]# pip install awscli
Collecting awscli
Downloading https://files.pythonhosted.org/packages/76/f4/63853217c2065cffaf84e7ca76d861509ee59c058959473f6b562cdda32f/awscli-1.16.265-py2.py3-none-any.whl (2.4MB)
Collecting awscli
Downloading https://files.pythonhosted.org/packages/76/f4/63853217c2065cffaf84e7ca76d861509ee59c058959473f6b562cdda32f/awscli-1.16.265-py2.py3-none-any.whl (2.4MB)
Uninstall a package
pip uninstall package_name
pip uninstall awscli
If you want to Test python Programs, you can check out this article.
Search packages
pip search "package_name"
[root@exampleserver ~]# pip search "awscli"
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
awscli-cwlogs (1.4.6) - AWSCLI CloudWatch Logs plugin
okta-awscli (0.4.1) - Provides a wrapper for Okta authentication to awscli
awscli-bastion (0.8.3) - awscli-bastion extends the awscli by managing mfa protected short-lived credentials
for an aws bastion account.
awscli-sqsall (1.0.1) - awscli pulgin to treat SQS queues more like files
awscli (1.18.47) - Universal Command Line Environment for AWS.
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
awscli-cwlogs (1.4.6) - AWSCLI CloudWatch Logs plugin
okta-awscli (0.4.1) - Provides a wrapper for Okta authentication to awscli
awscli-bastion (0.8.3) - awscli-bastion extends the awscli by managing mfa protected short-lived credentials
for an aws bastion account.
awscli-sqsall (1.0.1) - awscli pulgin to treat SQS queues more like files
awscli (1.18.47) - Universal Command Line Environment for AWS.
List Installed Packages
pip list
[root@exampleserver ~]# pip list
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Package Version
-------------------------------- -------
ansible 2.9.6
awscli 1.18.26
Babel 0.9.6
backports.ssl-match-hostname 3.5.0.1
botocore 1.15.26
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Package Version
-------------------------------- -------
ansible 2.9.6
awscli 1.18.26
Babel 0.9.6
backports.ssl-match-hostname 3.5.0.1
botocore 1.15.26
Upgrade PIP
pip install --upgrade pip
root@exampleserver ~]# pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 739kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.2
Uninstalling pip-8.1.2:
Successfully uninstalled pip-8.1.2
Successfully installed pip-20.0.2
[root@exampleserver ~]#
No comments