Python provides the
pip as a package manager in order to search, install, update and remove the 3rd party Python packages. The name pip comes from the
Pip Installs Packages . The Windows Python installer installs the pip command by default for the recent versions. But older versions of the Python installer do not install the pip command. In this tutorial, we examine how to install the pip explicitly by using different methods for Windows operating systems.
Check Python Installation
Before trying to install the pip command we can check if the pip command is already installed. As stated previously the pip command is installed with the recent versions of the Python automatically and there is no need to install it explicitly. The following command is executed in the MS-DOS command prompt but alternatively, the PowerShell can be also used without problem.
The ‘pip’ is not recognized as an internal or external command, operable program or batch file. message simply means the pip command can be found and executed.
Download get-pip.py File
The pip command installation can be done by using the
get-pip.py file. The get-pip.py file contains the pip installation script. The get-pip.py file is provided by the
pypa.io web page. It can be downloaded in different ways you can use the following link in order to
Save as via web browser.
Install Pip with get-pip.py File
The installation is very easy where the get-pip.py file is executed as a python script like below. This starts the installation of the pip command and related tools.
> python get-pip.py
When the installation is completed successfully we will see an output like below.
Successfully installed pip-22.1.1
Configure Environment Variables
After installing the pip command we should configure the environment variables in order to access the pip command from anywhere. By default, the pip executable can be only accessed via its installed directory, but we want to call it from different paths without a problem directly calling the
pip . The environment variables can be opened by typing
environment variables in the Start Menu.
The system properties window is listed below. In this system properties click to the
Environment Variables .
We will change the
Path environment variable so we click to the Path and then click to the
Edit button like below.
In order to add new path click to the
New like below.
Add the following path or file to the created line and then save by clicking
Print Pip Version
After completing the installation of the pip we can check the pip command version. The
--version option is provided to the pip command like below.
> pip --version
pip 21.2.4 from C:\Users\ismail\AppData\Local\Programs\Python\Python310\lib\site-packages\pip (python 3.10)
From the output, we can see that the installed pip version is
Update Pip Command
The pip command is also provided as a package and it is updated regularly as a package. So we can use the pip command in order to update itself.
> pip install --upgrade pip
Search Python Package
search option can be used to search Python packages or modules with the pip command.
> pip serch django
Install Python Package
A python package can be installed with the
install option like below.
> pip install django