What Is Pip In Python? – POFTUT

What Is Pip In Python?


Pip is a command and tool used to manage Python libraries, modules, and packages. Python has a lot of packages because of its popularity and installation, updating and removing them can be done with the Pip package manager.

Python Package Index

First, we have to learn about Python packages and repository. Python Package Index of PyPI is a repository that stores and serves Python packages. PyPI is created by the Python Software Foundation. Currently I provides 196,370 projects with 1,465,722 releases with 371,687 users.

https://pypi.org

Python Package Index
Python Package Index

From PyPI, we can search or browse projects and packages. For example, when we search for Django we will see the following results. We will click to the Django 2.2.5 which is the official Django project.

Python Package Index Search
Python Package Index Search

We will be redirected to the following Django Pip Package page which provides information like installation, project description, release history, download files bug tracker, source code, funding, and documentation.

https://pypi.org/project/Django/

Python Package Index Package Details
Python Package Index Package Details

Installing Pip

As Python is a cross-platform scripting/programming language also the package manager Pip is cross-platform too. We can install Pip for operating systems like Windows, Linux, Ubuntu, Fedora, Ubuntu, CentOS, Kali, Mint, MacOSX, RaspberryPi, etc where Python interpreter works. Below you can find how to install Pip for different operating systems and platforms.

How To Install Python Pip For Linux?

Pip Usage and Commands

In this part, we will learn basic usage of Pip and its commands. Pip provides commands to search, install, update, list, etc. packages.

Pip Help and List Commands

We can use the -h option in order to list simple help information about the pip command like below. Also, general options will be listed.

$ pip -h
Pip Help and List Commands
Pip Help and List Commands

For more detailed help man command can be used. This will list all available commands and options about the pip.

$ man pip
Pip Help and List Commands
Pip Help and List Commands

Search Python Package

We can use the search command and provide the term or package name we want to search. In this example, we will search the package named django.

$ pip3 search django
Search Python Package
Search Python Package

Show Python Package Information

We can show the package information with the pip command by using showcommand and providing the package name we want to show information. In this example, we will show information about the Django package.

$ pip3 show django
Show Python Package Information
Show Python Package Information

Install Python Package

We can install a package by using the install pip command. We will also provide the package complete name. In this example, we will install the package named Django. During the installation, the main package and its dependencies will be downloaded and extracted required fields.

$ pip3 install django
Install Python Package
Install Python Package

Update Python Package

Popular python packages are updated regularly.  We can update the already installed package with the install --upgrade command of the pip. We will also provide the package named django in this example.

$ pip3 install --upgrade django
Update Python Package
Update Python Package

List Installed Python Packages

We can also list already installed packages. We will use list pip command like below.

$ pip3 list
List Installed Python Packages
List Installed Python Packages

LEARN MORE  Pip ffi.h Gcc Error

Leave a Comment