Pip is the standard package manager for the Python programming language. It help you to install and manage packages on your system, which is not a part of the Python standard library. Using Pip you install required dependencies for a Python application. It uses Python Package Index (PyPI) for the packages and install on your system.
In this tutorial, you will learn to install Pip on your Linux based system. Also includes basis commands to work with Pip on your system.
Step 1 – Install PIP
There are several methods available for the Pip installation on any Linux system. You can choose any one method based on your operating system.
- On Ubuntu/Debian Linux – The default apt repositories contains Pip packages for the installation. Use the following command to install Pip on your Debian system.
Python 3:
sudo apt install python3-pip python-dev
Python 2:
sudo apt install python2-pip python-dev
- On Arch Linux – The Arch Linux users can also install pip from official repositories.
Python 3:
pacman -S python-pip
Python 2:
pacman -S python3-pip
Step 2 – Verify Installation
Check the install version of pip on your system using -V command line switch.
pip -V
pip3 -V
# For specific python version
To view a list of helpful commands.
pip --help
Step 3 – Installing Packages with PIP
Pip provides a simple command to install or uninstall packages on your system. Pip uses the following command to install any packages on your system.
pip install package-name
Also, you can easily remove the package:
pip uninstall package-name
Pip can also take the input from a file for the number of packages to install for a specific application. Add all the required packages name with their version with a properly formatted file like requirements.txt file and execute the following command:
pip install -r requirements.txt
Reference: https://en.wikipedia.org/wiki/Pip_(package_manager)
5 Comments
Update your blog please. Error after error. Last one:
ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.
We recommend you use –use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.
launchpadlib 1.10.13 requires testresources, which is not installed.
sudo apt install python3-pip
“`
$ python3 get-pip.py
Traceback (most recent call last):
File “get-pip.py”, line 23484, in
main()
File “get-pip.py”, line 198, in main
bootstrap(tmpdir=tmpdir)
File “get-pip.py”, line 82, in bootstrap
from pip._internal.cli.main import main as pip_entry_point
File “”, line 259, in load_module
File “/tmp/tmptdgifx_z/pip.zip/pip/_internal/cli/main.py”, line 10, in
File “”, line 259, in load_module
File “/tmp/tmptdgifx_z/pip.zip/pip/_internal/cli/autocompletion.py”, line 9, in
File “”, line 259, in load_module
File “/tmp/tmptdgifx_z/pip.zip/pip/_internal/cli/main_parser.py”, line 7, in
File “”, line 259, in load_module
File “/tmp/tmptdgifx_z/pip.zip/pip/_internal/cli/cmdoptions.py”, line 19, in
ModuleNotFoundError: No module named ‘distutils.util’
“`
sudo apt-get install python3-distutils
You saved me !!!