Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

community creator

What is a Python package manager (pip)?

Sandeep Varma

pip is a package manager that is written in Python. It is used for the installation of Python packages. All python packages are stored in an online repository called Python package index – pip connects to this online repository and installs the packages on the local system.

All Python distributions greater than the python 2.7.9 version has pip pre-installed. pip3 is pre-installed on python 3.4 and all latest versions. The latest version of pip is pip20.

Version of pip

# The below command is used to check the version of pip installed
python -m pip --version
In some versions of python you can use "pip --version"

Upgrade pip

# The following command is used to upgrade pip to latest version
pip install --upgrade pip

pip list

The pip list is a command that can be used to list available packages:

pip list

Installing packages using pip

We can use the pip install command to install any package:

pip install <package-name>

Uninstalling packages using pip

To uninstall any package, use the following command:

pip uninstall <package_name>

Using file

A file containing all the package names can also be used to install Python packages in batches.

Suppose we have a file (Required_Packages.txt) that lists of all the packages to be installed. We can install all these packages and their dependencies using:

pip install -r Required_Packages.txt

Creating package file

The Required_Packages file can be created using the freeze commandused to list the packages which are not installed

The command used to create the requirement file is:

pip freeze > Required_Packages.txt

Search packages in pip

The search command can be used to find a specific package in the list of available packages.

The command used to search a package is:

pip search numpy


community creator

View all Courses

Keep Exploring