Installing packages in python using PIP


(Sponsors) Get started learning Python with DataCamp's free Intro to Python tutorial. Learn Data Science by completing interactive coding challenges and watching videos by expert instructors. Start Now!


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 :

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

Click here for windows installation instructions .
Click here for linux instructions .

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.

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.

Upgrade Package

Searching for a package

Note: You don’t need to add quotes around your search term.

Listing installed packages

above command will list all the installed packages.

Listing outdated installed packages

Details about installed packages

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

 


Other Tutorials (Sponsors)

This site generously supported by DataCamp. DataCamp offers online interactive Python Tutorials for Data Science. Join over a million other learners and get started learning Python for data science today!


5 thoughts on “Installing packages in python using PIP

  1. Jackie

    Hello,

    I am a newbie in Python and have some problems importing packages such as numpy.

    I have just installed Python 3.7.0 for Windows (Windows 10) and there appeared three different icons in that list when you press the Windows icon at the left corner of the task bar: IDLE, Python 3.7, Python 3.7 Module Docs. All these have their own screen. But I do not know which screen should be used for which type of command. That is a bit confusing.

    Anyway, I decided to use IDLE to write my commands. Just for the sake of trying, I wrote
    python -V
    and it already gave a “NameError: name ‘python’ is not defined”.
    When I tried to install numpy with the command (pip3 install numpy), it gave SyntaxError as invalid syntax. I do not understand where the problem lies.

    Actually, I would like to start a data science blog to record and practice the knowledge I acquire in my data science journey with the help of Jupyter Notebooks. Yet, being stuck in the first steps of this journey encouraged me to write this message. I do hope that you can help me.

    Many thanks in advance.

    Reply
    1. PythonGuru

      Execute the commands you mentioned in the Command Prompt instead of IDLE, or Python shell. To start the command prompt hit CTrl+R and type “cmd” without quotations.

      That’s all

      Reply
      1. Jackie

        Writing those commands in the command prompt worked perfectly. Now I can start to work on my Jupyter Notebook. Thank you sooo much!

        Reply

Leave a Reply

Your email address will not be published. Required fields are marked *