Installing packages in python using PIP

Updated on Jan 07, 2020


PIP is a package management system used to install packages from repository. You can use pip to install various software packages available on http://pypi.python.org/pypi.  PIP is much similar to composer in php. PIP is a recursive acronym which stands for PIP installs packages.

Installing PIP #


Python 2.7.9 and later (python2 series), and Python 3.4 and later (python 3 series) already comes with pip.

To check your python version you need to enter the following command :

python  -V

If your python version do not belong to any of above mentioned versions then you need to manually install pip (see links below) .

Installing packages #


Suppose you want to install a package called requests (which is used to make HTTP requests). You need to issue the following command.

1
2
3
pip install requests # this will install latest request package
pip install requests==2.6.0 # this will install requests 2.6.0 package not the latest package
pip install requests>=2.6.0 # specify a minimum version if it's not available pip will install the latest version

note:

pip.exe is stored under C:\Python34\Scripts, so you need to go there to install packages. Alternatively, add the whole path to PATH environment variable. This way you can access pip from any directory.

Uninstalling packages #


To uninstall the package use the command below.

pip uninstall package_name

Upgrade Package #


pip install --upgrade package_name

Searching for a package #


pip search "your query"

note:

You don't need to add quotes around your search term.

Listing installed packages #


pip list

Above command will list all the installed packages.

Listing outdated installed packages #


pip list --outdated

Details about installed packages #


You can use the following command to get information about a installed package, i.e Package name, version, location, dependencies.

pip show package_name

Other Tutorials (Sponsors)