Pip is a python package management system which can also be used to install various software written in Python and Python modules and their respective dependencies.
In this module, we will learn about pip and cover the following topics.
This step is important because PIP is pre-installed in Python version 3.4 and above. So why go through the trouble of trying to install if you already have it right? So, in order to check if you already have PIP or not, just type the following command in your Python shell.
If you find that you already have PIP then you can skip the next topic of installing PIP and go straight to learning how to download a Package using PIP.
In case you do not have PIP installed, follow the following step to install it.
Step 1: Click here and download the file named get-pip.py.
Step 2: Once you have downloaded the get-pip.py file, open your cmd and navigate to the folder where your downloaded get-pip.py file is and run the following command:
This command will install and upgrade pip.
Downloading a package using pip is a cakewalk. PIP makes downloading packages and modules really easy and convenient. Just run the following command in your command line.
The above command will download and install the package named scrapy which is used for scraping information from websites. You can download any package that you like, just replace scrapy with the name of the package that you want to install in the above-mentioned command.
Now that you have installed your package, you can easily use it by simply importing the package in your program using the following syntax:
This is also as simple as installing the package, just type and run the following command in your command line:
The PIP manager will ask you to confirm if you really want to remove the package before removing it. Just type y if you want to remove and n if you don’t want to remove.
Pip is not only used for installing and uninstalling Python Packages. It is a package manager. You can manage all your Python packages using pip. You can search for a package or just list down all the available packages using PIP
This command will search for the package named scrapy, you can search for any package, just replace scrapy with the name of the package that you want to search.
With this, we come to an end of this module. The next module explains Python exception handling.
Download Interview Questions asked by top MNCs in 2019?