What is PIP in Python?
PIP is a Python package management system that can also be used to install various software written in Python and Python modules and their respective dependencies.
So, without further delay, let’s get started.
How to Install PIP in Python on Windows?
Before we proceed to install pip in Python, we should check once if pip is pre-installed in Python version 3.4 and above.
Checking If PIP Is Installed
This step is important because PIP is pre-installed in Python version 3.4 and above. Then, why go through the trouble of installing it if we already have it in our system? So, before installing PIP, we have to check whether it is already installed in the system or not. To check that, just type the following command in the Python Shell:
<span style="font-weight: 400;">pip --version</span>
Output
If we find that we already have PIP in our system, then we can skip the next topic of installing PIP and go straight toward learning how to download a package using PIP.
Installing PIP in Python on Windows
In case we do not have PIP installed in our system, follow the below steps to install it:
Step 1: Click here and download the file named get-pip.py
Step 2: Once we have downloaded the get-pip.py file, open our cmd, navigate to the folder where our downloaded get-pip.py file is present, and run the following command:
python get-pip.py
This command will install and upgrade PIP.
Become a Certified Python Programmer
Master Python Programming and Start Building Powerful Applications
How to Use PIP in Python?
Alright now that we have successfully installed PIP, let us talk about downloading packages using PIP, removing a package using PIP, listing, and searching packages using PIP.
Downloading a Package Using PIP in Python
Downloading a package using PIP is a cakewalk. PIP makes downloading packages and modules really easy and convenient. To download a package, just run the following command in our command line:
pip uninstall scrapy
The above command will download and install the package named ‘scrapy’ which is used for scraping information from websites. We can download any package that we like, by just replacing ‘scrapy’ with the name of the package that we want to install in the above-mentioned command. [Want to know more about Web Scapping ?]
Get 100% Hike!
Master Most in Demand Skills Now!
Now that we have installed our package, we can easily use it by simply importing the package into our program using the following syntax:
pip show scrapy
Removing a Package Using PIP
Removing a package is also as simple as installing it; just type and run the following command in our command line:
pip uninstall scrapy
The PIP manager will ask us to confirm if we want to remove the package before removing it. Just type y if we want to remove the package or n if we don’t want to remove it.
Build Your Reputation as a Data Analyst Leader
Join the Best Data Analysis Training Program
How to List and Search Packages with Pip in Python?
PIP is not only used for installing and uninstalling Python packages. It is a package manager. We can manage all our Python packages using PIP. Moreover, we can search for a package or just list down all the available packages using this package manager.
- To list all packages, type the following command in our command line:
pip list
- To search for a particular package, type the following command in our command line
pip search scrapy
This command will search for the package named ‘scrapy’. We can search for any package, by replacing ‘scrapy’ with the name of the package that we want to search for.
With this, we come to an end of this module in Python Tutorial. Go through these Basic Python Interview Questions and Answers to excel in your career.
Our Python Courses Duration and Fees
Cohort starts on 11th Jan 2025
₹20,007
Cohort starts on 11th Jan 2025
₹20,007
Cohort starts on 11th Jan 2025
₹20,007