In this tutorial, we will learn how to install the Pip package manager for Python in Windows PowerShell.
Pip is a tool that allows you to easily manage and install different Python packages.
Having pip installed on your system is essential for working with Python and its packages. To get started, follow the steps below.
Step 1: Download get-pip.py
First, you need to download the get-pip.py
script, which is used to install pip. Visit the official pip website by following this link and download get-pip.py
script by right-clicking the link and selecting “Save Link As…”. Save the file to a directory on your computer, for example, C:\Users\YourUsername\Downloads
.
Step 2: Open PowerShell as an Administrator
Next, open Windows PowerShell by pressing Windows key
and typing “PowerShell”, right-click on the result, and then select “Run as administrator”. This is necessary to grant PowerShell the required permissions to install pip.
Step 3: Change to the Downloads directory
Navigate to the directory where you downloaded the get-pip.py
script in Step 1. To do this, type the following command in PowerShell and press Enter
:
1 |
cd C:\Users\YourUsername\Downloads |
Make sure to replace “YourUsername” with your actual Windows username.
Step 4: Install pip
Run the following command to install pip using the get-pip.py
script:
1 |
python get-pip.py |
Wait for the installation process to complete. Once it is done, you will see a message that says “Successfully installed pip”, along with some other information.
Step 5: Verify pip installation
To verify whether pip has been installed successfully, run the following command:
1 |
pip --version |
The output should show the installed pip version, along with the Python version it is associated with.
pip 21.2.3 from C:\Users\YourUsername\AppData\Local\Programs\Python\Python39\lib\site-packages\pip (python 3.9)
Replace “YourUsername” with your actual Windows username.
Full Code
1 2 3 |
cd C:\Users\YourUsername\Downloads python get-pip.py pip --version |
Replace “YourUsername” with your actual Windows username.
Conclusion
Congratulations! You have successfully installed pip in Windows PowerShell. Now you can use pip to manage and install Python packages easily. Make sure to explore the pip documentation for more information about its features and usage. Happy coding!