Having a management system for installing python-based software can be useful. This makes it easier to navigate through python-based applications and packages.
This is why most users find Pip convenient to have to manage their Python libraries. The installation steps are simple and shouldn’t take you long!
Below, I’ll guide you on how to install pip and how you can use it to manage python packages:
What Is Python Pip?
“Pip Installs Python” also abbreviated as (p i p) is the standard package manager for python. It simplifies the installation and management of python software and applications.
Users get pip when they want to manage or add applications and libraries. Usually, these additions aren’t included in the standard python library.
Prerequisites For Installing Pip
First, make sure to check if you have python installed. For Linux users, this is included by default. Those who use Mac OS have python 2.7 included.
You need to install python3 before proceeding with the pip installation. For Ubuntu users, you can install Python 3 when you run the following command:
sudo apt-get update
sudo apt-get install python3
Before proceeding, make sure you log in using the sudo command. This allows you to run programs with the security privileges of another user.
Just to be sure, you can download the “get-pip.py” file from here: https://pip.pypa.io/en/stable/installing/
For Mac Os users, you must download the latest python3 OS X package first before you can proceed with the installation.
Once the python 3 installation is complete, we can now move to installing pip3.
How To Install Pip3
The steps to install pip3 are simple and easy to follow. Once you have python 3, use the following command to install pip3:
sudo apt-get update
sudo apt install python3-pip
When you run this command, it installs the applications used to build python modules.
If you want to want to verify the version of pip installed, you can run the following command below:
How To Use Pip
If you want to install many python modules globally, I’d recommend you to use the apt package manager. This makes it easier to install distribution-provided python modules.
For Ubuntu users, it’s proven and tested to work well. Sometimes there are no packages available through the package manager. In this case, you should use pip to install python modules.
Using the following commands below allows you to install pip3 packages using pip:
pip3 install package_name
Let’s say the program you want to install is scrapy, it should look like this:
pip3 install scrapy
If, let’s say, you want to install a specific version of the package, the command should look like this:
pip3 install scrapy==1.5
Some users may have the python 2 instead of the python 3. In this case, the commands remain the same but replace pip3 with pip.
Installing Packages Using Requirements Files
Some users may want to use a single file for installing many pip packages. The requirement.txt is a list of requirements specified in a file.
It contains all pip packages and their versions used to run specific python projects.
To install a list of packages, use the following command below:
pip3 install -r requirements.txt
You can also list all of the installed packages using the command below:
For uninstallation, run the command below as follows:
pip3 uninstall package_name
This guide is for how to use pip for Ubuntu. Pip doesn’t come installed by default, but the installation process is simple. By following this guide, you can perform it without any professional help!
I hope this has guided you on how to install pip and how you can use it to manage your python packages.