Python PIP With Examples

In this tutorial, we are going to learn about Python PIP installation and how to use pip in python. In our previous tutorial, we learned about Python Daemon Thread.

Python pip

Python PIP is a package manger, you can use it to install certain libraries to your python installation. You can say it is a replacement for easy_install. We can use pip to install python modules and their dependency also.

In more simple way if we can elaborate PIP in one statement then, Pip is a package management system used to install and manage software packages written in Python. You can download PIP installation file from this link.

Question: Python 2.x Vs Python 3.x :Do I have already PIP?

PIP is there if you are on Python 2 >=2.7.9 or Python 3 >=3.4 binaries downloaded from, but you’ll need to upgrade pip. Also, pip will be there if you are working in a Virtual Environment created by virtualenv or pyvenv.

Python Install pip

There are many ways to install pip, but my preferred method is the following:

Download the in your system or copy content of the above url in a text file and rename it to

Open a CMD window and select the folder location where the file is located. Run python
For verification of a successful installation, open a CMD window and navigate to scripts folder under Python folder (Default is C:Python27Scripts). Type command from this location to launch the Python interpreter.

pip freeze

It will show the version number of all modules installed in your Python non-standard library; on a fresh install, if there is any error it will be pop up.

Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.
C:UsersUsername>cd c:Python27Scripts
c:Python27Scripts>pip freeze

Set environment variable for PIP

If you set PATH environment variable then you won’t have to reference the pip install directory again and again.
Set: (default = C:Python27Scripts) in your Windows/Linux “PATH” environment variable.

PIP Installation for other OS

If you’re running Linux, it’s usually already installed. For other OS follow below steps.

  • Ubuntu:
    $ sudo apt-get install python-pip
  • Fedora:
    $ sudo yum install python-pip
  • Mac, you need easy_install:
    $sudo easy_install pip

How to use Pip and PYPI

PYPI stands for Python Package Index. It’s required for finding a package to install. Packages will be installed from the Python Package Index. PYPI is a repository of software for the Python programming language.

Getting Started with PIP

To install a package using PIP, just open up your terminal, and type in a search query using the PIP tool.

PIP Commands

Enter pip in your terminal, it will show the following output on screen.

  pip  [options]
  install	Install packages.
  uninstall     Uninstall packages.
  freeze        Output installed packages in requirements format.
  list          List installed packages.
  show          Show information about installed packages.
  search        Search PyPI for packages.
  zip           Zip individual packages.
  unzip         Unzip individual packages.
  bundle        Create pybundles.
  help          Show help for commands.

Commonly used command for pip is install, upgrade or uninstall.

PIP Search packages and modules

For searching any package, i.e. Flask command will be like below.

pip search Flask

Following output will be shown with all packages and description.


Installing a package

If we want to install a required package, let’s say in our case it’s Flask. Now to install it :

pip install Flask

Pip – Show information

For checking information about our newly installed packages.

pip show Flask
Name: Flask
Version: 0.10.1
Location: /usr/local/lib/python2.7/dist-packages
Requires: Werkzeug, Jinja2, itsdangerous

Uninstalling a package

For uninstalling any package installed by PIP, you can do as below.

pip uninstall Flask
Uninstalling Flask:
Proceed (y/n)?
Successfully uninstalled Flask

That’s all about python pip installation and it’s usage. To know more, see their official documentation.

By admin

Leave a Reply

%d bloggers like this: