List of content you will read in this article:
- 1. How to install PIP on Windows? [A Step-by-Step Guide]
- 2. How to install PIP on Linux? [A Step-by-Step Guide]
- 3. Conclusion
In this article, we will learn how to install PIP on Windows and Linux operating systems, but first, we should know why we need PIP. When you are dealing with Python, there is a requirement for tons of packages. You can use the available ones with the help of the default package manager; however, PIP might be required to install some. with PIP or Package Installer for Python, You can install the software packages or libraries that are not included in the Python Standard Library.
Moreover, if you seek to install additional dependencies or packages, you can simply install PIP on Windows and Linux operating systems. PIP uses Python Package Index for all the packages. You must be familiar with the term package manager if you know the programming world. This tutorial will guide you on how to install PIP on Windows and Linux.
Let us now head towards the process of installing PIP in Windows first!
How to install PIP on Windows? [A Step-by-Step Guide]
Let's move to understanding the complete step/procedure.
- The first step is to check whether PIP is installed on your desktop or not to install PIP on Windows.
- To check that, simply go to your command prompt, and write the following:
- Now, If a response occurs, that’s a clear indication that your system has already PIP installed. If it doesn’t, an error message appears on the screen, ‘program could not be found.
- Next up is the verification of the Python installation. PIP needs an active Python installation in the system. To confirm whether you have Python already installed or not, head on to the command prompt window and type:
- If the command goes unresponsive and nothing shows on the screen, you need to install Python before installing PIP.
- Once you install Python, this is what your screen is going to display. Take a look:
Python 3.7.0 (v3.7.0:1bf9cc5093, Jan 25 2019, 07:44:31) [MSC v.1914 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Let us quickly understand how to install PIP on the Windows process.
Follow these steps to achieve your task:
Step 1: You need to download PIP get-pip.py
You have to download get-pip.py before installing PIP. Now, remember the location where you save the file as this path is required in the process later.
Step 2: Open the Windows Command Line
The next step is to open the Command prompt window. Simply follow these steps:
- Select Windows key + X
- Hit run
- Now type cmd.exe
If not these steps, you can simply type cmd in the search bar, and the command prompt will be displayed on your screen.
Additionally, there are instances where you have to run/access the prompt window as an administrator. Now, when can you encounter these situations? Sometimes, while you perform a task, you may encounter a message saying that you do not have access to some specific permissions to run an application or a program. In such situations, you are required to run the app as an admin.
To conclude, click right on the Command Prompt and choose ‘Run as,’ then select As Administrator. And you’re done!
Step 3: Install PIP on Windows
Now, open the Command Prompt, type the cd command, and then the path where you saved the get-pip.py file. Remember?
Cross-check the file’s path, as this can later cause a problem in the installation process.
Now, follow this command:
After this, the installation process begins.
Moving on, to display the list of your current directory, type:
Step 4: Check the PIP version
If you wish to see the version of your PIP, go to the Command Prompt and type the following command:
The current version is displayed on the screen.
Step 5: Installation verification
As you had earlier initiated the installation process, you can now check whether the process is successful.
If your installation is successful, you will encounter this message.
pip 18.0 from c:\users\administrator\appdata\local\programs\python\lib\site-packages\pip (python 3.7)
If not, kindly repeat your installation.
Step 6: How to configure?
The PIP configuration file in Windows is %HOME%\pip\pip.ini located at %APPDATA%\pip\pip.ini. Now, if you want to set the location as per your wish, use PIP_Config_File.
Moreover, if you wish to upgrade your PIP version, you can do that. It discards the older version and installs the latest one. To accomplish this task, type the following command:
python -m pip install --upgrade pip
Moving onto the last segment, what if you want to downgrade the installed PIP version in your system? Well, you may think, why is this necessary?
Well, there are times when you install a new version, and it does not work seamlessly. To sort that issue, you need to downgrade the version to revert to the previously installed version. Use this command:
python -m pip install pip==18.1
That’s it! Yes, it is this simple process through which you can install PIP on Windows. Let us head toward our next segment.
How to install PIP on Linux? [A Step-by-Step Guide]
Now, Python Package Index is used by PIP as the default source for the packages. Hence, when you type,
pip install package_name
This command scans for the mentioned package in PyPI. As soon as it finds the package, it downloads and installs it. It depends on which version, either Python pip or Python3-pip, you’re working with.
Here is a step-by-step guide to the whole process screenshot.
Step 1: Start by typing the following command:
Sudo apt-get install python3-pip python-dev
Step 2: Next up, you will see this window.
Here, the installer is simply providing the disk space.
Step 3: Next, it downloads the libraries as shown below.
Step 4: Now, all the files and packages start unpacking.
Step 5: Lastly, the few more steps of the installation look like this.
root@ubuntu:~# pip3 install <package name>
As we have taken the example of the Numpy library, just write NumPy in the place of the package name. Here is how:
root@ubuntu:~# pip3 install numpy
Step 6: Moving on, let’s say you want to search for the availability of some packages. Use this command:
root@ubuntu:~# pip3 search numpy
Step 7: Next, to know all the Python packages installed in the system, follow this command:
root@ubuntu:~# pip3 list
To gain any additional information about the installed packages, use the following:
root@ubuntu:~# pip3 show numpy
Step 8: Now, finally, if you wish to uninstall the packages, use this simple command:
root@ubuntu:~# pip3 uninstall numpy
We hope that with the help of this article, you have successfully learned how to install PIP on Windows and Linux operating systems. You can now easily manage your packages with the help of Python PIP. If you face any issues during the installation or have questions, please leave them in the comment box below.
Keep learning and Keep Sharing!