How to install and use Python and PIP in Windows

By on April 18th, 2022

Python, It’s an object-oriented high-level programming language that is used for rapid application development. It has high-level built-in data structures combined with dynamic typing and binding. Python is also used for scripting languages as well as, and it can be used as a mediator to connect existing components or devices. In simple words, Python is the most accessible programming language that we can use to create any web app or AI. One of Python’s most significant advantages is that it reduces the cost of maintenance. Python supports different modules and packages, making our code modular and reusable. There are thousands of people who use Python just because of its high productivity. So, in this article, we will discuss how we can install Python and Pip on windows. But before we start, let’s understand what pip is.

What is pip?

Pip is a standard package manager for the Python programming language. We need to install pip because it allows us to install and manage all the third-party packages. These third-party packages are used to add more features and functionality, which is not available in python’s standard library. Some latest python packages are available recently, like python two and python 3, which come with pip packages by default. But, in case you could not find it, we will learn how easily we can install pip or upgrade pip on the Windows system. We will also learn to include environmental variables created by virtualenv and pyvenv. So, as we discussed, we will learn how to install Python and pip on windows and upgrade pip on windows ideally. So let’s understand the tutorials step by step.

Pre-requirements for Pip installation

Check if python is already installed.

Step 1:  Open CMD(Command Prompt). You can press the Windows key, search for CMD, and press Enter.

Step 2: Now, execute python --version or python -V to check if Python is installed on your machine.

As per the above image, we can say that this machine has no python installed. If you have the same result line as “Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases,” we must install python first.

And if you have already installed python on your machine, you will have a result line like “Python 3.10.4“. You can see the below image, which shows the installed python version.

Check if pip is already installed.

First of all, we have to check if the pip is already installed. So, we can check it through CMD(Command line), copy the following commands, and paste them into the command prompt or follow the steps.

Step 1:  Open CMD(Command Prompt). You can press the Windows key, search for CMD, and then press Enter.

Step 2: Now, execute pip --version or pip -V to check if pip is pre-installed on your machine.

Now, if you have a result line like “‘pip’ is not recognized as an internal or external command, operable program or batch file.” just as upon image. It means you don’t have the pip installed in this machine. 

And If you have a result like “pip 22.0.4 from C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\site-packages\pip (python 3.10)”. It simply means you have already installed pip on this windows machine. You can see all the results upon command in the below image.

Install Python

So, we will first learn how we can install python on a windows machine. You can follow the following steps and easily install python in a couple of clicks. So, let’s start the installation process of python.

Step 1: Go to any browser you have, search for Python Download, and press Enter. Then click on the first link to Download Python, as you can see in the below image.

Step 2: Here, you will redirect to the download page; here on this page, you can see a button as Download Python (Version), as you can see in the below image. Now, click on the button to start the download.

Note: Make sure you download the latest version as per the device requirements. This button will allow you to download the .exe file, an executable or setup file of windows.

Step 3: Now, go to the folder that contains the python.exe file. Double click on the file to run the setup, or you can Right-click on the file and select open, as you can see in the image below.

Step 4: Click on the first option available as Install Now on the installation wizard, as shown in the image below. Then sit back and relax. It will take a couple of minutes to install python.

Step 5: After the successful installation, you will have a final screen, as shown in the image below. Click close to complete the process.

You just successfully installed the latest version of python on the machine.

Note: The latest version of python setup files already comes with pip by default. So, if you just followed the steps for python installation, then you must check if the pip is already installed with the Python setup file.

Install pip with Get-Pip.Py

Python’s latest versions have already included the pip by default in the setup files. But we can install it separately, or we can upgrade it manually. To learn how to install and update pip on a windows machine, follow the steps.

Step 1: First, we need a copy of the get-pip.py file on our machine. You have to be sure about the python version and supported pip version. You can download the file from pypa.io or use the following command to copy the file from the server to the local machine.

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

Step 2:  After the successful download, we have to install the downloaded pip. To Install the pip, copy and paste the following command.

python get-pip.py

Step 3: Now, check the pip version as discussed earlier in this article. Just paste the following command or type pip -version.

pip --version

Congratulations, you successfully downloaded and installed python’s latest version and pip on windows.

Upgrade Pip

We can download and install the pip on windows machines, as we learned. Just like that, we also can upgrade the pip to the latest version. Keep following the steps to learn how to upgrade pip on windows. We keep up to date with pip because it works as an ecosystem for python. Whenever we have the latest version of pip in the market, it comes with the latest features and resolves the old bugs. 

Step 1: Open the CMD(Command Prompt). Press the Windows key and search for the CMD, then press Enter.

Step 2:  Then, Copy and Paste the following command into the CMD, as you can see in the image below.

python -m pip install -U pip

This command will automatically remove or uninstall the older version of pip and install the latest version. With the help of this command, it’s also possible to downgrade the pip version. 

Add Environment Variables for Pip

After the installation, a fundamental error always creates a problem called “not on PATH.” This error comes just because python can not find the tool to run our current directory. To resolve the issue, we need to add the variables to the environment section. So, follow the steps to resolve the issue and add the environment variables for python.

Step 1: Open the Control Panel and navigate to the  System and Security, as shown in the below image.

Step 2: Then click on the System section, as you can see in the image below. 

Step 3: Now, find Advanced System Settings and click on it to open the advanced setting section, as shown in the image below.

Step 4: Then, click on the Environment Variables button on the advanced setting section popup box. See the below image to catch the button.

Step 5: Here, on the new popup box, you will notice two sections: User variables and System variables. Now, go to the system variables and select path, then double click on the path to open, as shown in the below image.

Step 6: Here, you have a window open with several options. We have to add an Environment variable, so click on the New button and add the following details. Then click on the Ok button to save it.

C:\Python33\Scripts

Congratulations, you just successfully added the Environment Variables for Python.

Conclusion

So, we learn how easily we can install Python and Pip on Windows machines. We also know how we can check the current versions of both. And lastly, we also add environmental variables to remove some specific errors. You can easily upgrade and downgrade the versions for both Python and Pip with the following methods.

Leave a Reply