What is PIP in Python?

PIP is an inbuild(for python version3.4 & above) Python packages manager that can be used to install or uninstall a Python package, for example, like TensorFlow, pandas, etc.

It is really easy to use PIP, for one those who have Python version less than 3.4 can download the PIP by clicking here Download PIP This page will help you to download PIP.

Checking the version of the PIP

To check the version installed of the PIP use the command prompt/shell change the drive to where Python script file and type¬† the following command ‘pip –version’

C:\Users\PT\AppData\Local\Programs\Python\Python37\Scripts>pip --version
Output:
pip 19.2.3 from c:\users\PT\AppData\local\programs\python\python37\lib\site-pa
ckages\pip (python 3.7)

 

So the Installed version of PIP on my PC is 19.2.3

Note: Path mentioned above is for my PC might be different for different users kindly check first.

Installing packages and using them

Installing a package is very much easy using the PIP command.

Use the command prompt/shell change the drive to where Python script file and type¬† the following command ‘pip install package_name’

We will see how to install pandas

C:\Users\PT\AppData\Local\Programs\Python\Python37\Scripts>pip install pandas
Output:
Requirement already satisfied: pandas in c:\users\rani\appdata\local\programs\py
thon\python37\lib\site-packages (0.25.3)
Requirement already satisfied: pytz>=2017.2 in c:\users\rani\appdata\local\progr
ams\python\python37\lib\site-packages (from pandas) (2019.3)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\rani\appdata\l
ocal\programs\python\python37\lib\site-packages (from pandas) (2.8.1)
Requirement already satisfied: numpy>=1.13.3 in c:\users\rani\appdata\local\prog
rams\python\python37\lib\site-packages (from pandas) (1.17.4)
Requirement already satisfied: six>=1.5 in c:\users\rani\appdata\local\programs\
python\python37\lib\site-packages (from python-dateutil>=2.6.1->pandas) (1.13.0)

So we have successfully installed the pandas. (It will take some time to download)

Using the package in Python code

To use the package in a Python code we simply have to follow the syntax below:
import package/library_name
Let’s import the pandas and read a CSV file

import pandas 
dataset = pandas.read_csv("filename.csv")

So this was all about PIP in Python.

Leave a Reply