How to install PIP on Windows
What is PIP?
PIP is a standard Package Manager for Python. It is a command-line tool that helps you to install and uninstall external packages or dependencies very easily. You can call it “PIP installs packages,” too.
These external packages are stored online in a repository called PyPI(Python Package Index). PIP saves time and effort by maintaining the Python packages unavailable in Python’s Standard Library. It helps you to save time by automating time-consuming tasks. PIP makes it easier to install different modules. It maintains the packages and dependencies efficiently.
Let’s learn Python concept of how you can install PIP on windows and the problems faced while installing PIP.
How to Check if PIP is already installed?
PIP is automatically installed in Python 3.4 and higher versions. To check if PIP is already installed on your PC or not, execute the following steps:
Step 1) Run the Command prompt.
Step 2) Type the following command.
pip help
If PIP is installed, then it will respond otherwise it will show you an error.
How to Download and Install PIP
You need Python installed in your Windows Machine before installing PIP. Use the following command to check whether Python is installed on your PC:
python —version
If Python installation is already done, you will get something like this-
C:\Users\Guru99>python --version Python 3.10.9
There are two ways to install PIP, either by using:
1) cURL
2) You can install PIP on windows manually
Method 1: How to Install PIP on Windows Manually
You can manually install PIP, just use the correct version of the get-pip.py file from pypa.org. This get-pip.py is a bootstrapping script that is used to install PIP in Python environments. Here are the steps to manually install PIP on Windows:
Step 1) Visit https://bootstrap.pypa.io/get-pip.py
Step 2) Right Click on the Mouse and save the get-pip.py file.
Step 3) Move the get-pip.py file to the same folder where you have Python installed.
Step 4) Open the Command Prompt window and change the directory to the same directory as above.
Step 5) Run the following command in the Windows command prompt.
python get-pip.py
Output-
C:\Users\Guru99>python get-pip.py Collecting pip Using cached pip-22.3.1-py3-none-any.whl (2.1 MB) Installing collected packages: pip WARNING: The scripts pip.exe, pip3.10.exe, and pip3.exe are installed in 'C:\Users\Priya\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH. Successfully installed pip-22.3.1 C:\Users\Guru99>
This process will take some time, and PIP will be installed on your system. That’s how you will install PIP on windows Manually.
Method 2: How to install PIP on Windows Using cURL in Python
cURL (Client URL) is a command-line tool that allows you to exchange the data between the server and the device using the terminal.
You can use cURL to install Python PIP on windows. Follow these steps:
Step 1) Open the Command Prompt Window
Step 2) We need to request data from the server using cURL. Use the following command:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Output-
Step 3) Run the following command
python get-pip.py
PIP will be installed
How to Check if PIP is successfully installed?
In order to verify whether PIP was successfully installed on your system, let’s run a version check in the terminal.
Open your command prompt window and type this command-
Syntax:
pip -V
Or
pip —version
If this command returns the PIP version, then PIP is installed on your system.
How to add PIP to Windows Environmental Variables
Now that you have successfully installed PIP, you would like to be able to run it from anywhere. You’ll get an error like this “not on Path” if you try to run it from another directory. To add this, you will need to add PIP to Windows Environment Variables.
Here are steps to add PIP to Environmental Variables:
Step 1) Open the Control Panel and search for system and Click Edit the system Environment variables
Step 2) Open the Environment Variables.
Step 5) Select the PATH, and then new, add the folder where you have Python PIP installed, and then select ok.
Usually the path is C:\Python34\Scripts\pip
How to manage Python Packages With PIP
You have successfully installed PIP. Now, you can easily install and manage Python packages.
You can install any Python Package using the following command:
pip install <package-name>
The latest version of that package will be installed using this PIP command. If you want PIP to install a specific version of a package, you can use the following command:
pip install <package-name==version>
You can view the information of a package using the following command:
pip show <package-name>
Use this command to uninstall a package–
pip uninstall <package-name>
How to Upgrade PIP in Windows
You should update PIP whenever a new version of PIP is released. These new versions of PIP are released frequently, as they may add some improved functionalities to PIP.
Check the current version of PIP by running the following command:
pip —version
After checking the version of PIP, you can use the following command to check for a PIP upgrade-
python -m pip install — upgrade pip
This command will uninstall the current version of PIP from your system and install the latest version of PIP.
How to Downgrade Pip on Windows
Newly released versions of PIP may work improperly, or some versions may not support your system; then you can downgrade PIP using the following command-
python -m pip install pip==version_number
You can change the version you want to install instead of version_number in the above command.
How to Uninstall PIP on Windows
If you want to uninstall PIP, type the following command in your command prompt-
Pip uninstall pip
The system will ask for confirmation, and then PIP will be uninstalled.
Wrapping Up
- PIP is the standard package manager for Python, which you can use to install external packages.
- These external packages are stored online in a repository called PyPI(Python Package Index).
- We learned how to install, uninstall, and view the information of a package.
- Next, we learned about upgrading, downgrading, uninstalling, and installing PIP on Windows.