In this guide, we consider every detail of PIP with the installation process (if you have Python 2> = 2.7.9 or Python 3>=3.4, then don't worry; your system has a PIP pre-installed).
How to Install PIP?
We have divided the article into two parts, the first part explains the procedure to install PIP in different Linux operating systems. The other part, explains the procedure for Windows.
Install PIP Linux [install pip Ubuntu]
First, open the Linux terminal in the system and execute the following commands:
- Commands to install PIP on Debian/Ubuntu (PIP install Ubuntu):
# apt install python-pip #python two
# apt install python3-pip #python 3
- Commands to install PIP on RHEL and CentOS:
# yum install epel-release
# yum install python-pip
Remember that PIP is not packaged for the RHEL/CentOS software repositories that's why we have used the EPEL repository for the installation procedure.
- Commands to install PIP on Fedora (install PIP Fedora):
# dnf install python-pip #Python 2
# dnf install python3 #Python 3
- Commands to install PIP on Arch Linux:
# pacman -S python2-pip #Python 2
# pacman -S python-pip #Python 3
- Commands to install PIP on openSUSE:
# zypper install python-pip #Python 2
# zypper install python3-pip #Python 3
Other Helpful Commands to Use PIP in Linux
- For installing or uninstalling new packages, use the following commands:
# pip install packageName
# pip uninstall packageName
# pip search packageName
- Command to see the list of the PIP commands:
# pip help
- So here is the sample output:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
check Verify installed packages have compatible dependencies.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
help Show help for commands..
Install PIP Windows
First, check the presence of PIP in the system, and execute the following command in the command prompt (open the command prompt from the Start Menu with the administrative privileges).
If the system responds to the above command, then your system has pre-installed PIP. Otherwise, the system shows an error for the above command.
Now download the PIP get-pip.py because it is required before installing PIP. You may download it from: get-pip.py on pypa.io.
After downloading, open the command prompt and execute the cd command followed by the folder name for navigating to the file location of the get-pip.py file.
For installing PIP, execute the following command:
On execution of the command, the installation procedure will begin, but if you don’t find the file, you must double-check the path of the saved file.
You can also view the current directory’s contents by the following command:
This dir command will return the full listing of the directory's contents.
For checking the PIP version, use the following command:
In case to verify the installation, type the following command in the command prompt:
After executing the command, your system will provide the information like this:
pip 18.0 from c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)
If your system detects any issue, you will not see the above message or receive an error. In such a case, it is better to repeat the installation procedure.
Now PIP requires a proper configuration and the PIP configuration file is %HOME%\pip\pip.ini. Besides that, it also has a legacy per-user configuration file, so this file is located in %APPDATA%\pip\pip.ini.
You can also set any path location for the config file through PIP_CONFIG_FILE, which is an environment variable.
For upgrading the PIP files for Python, run the following command in the command prompt:
python -m pip install --upgrade pip
This particular command will start to uninstall the older versions of PIP and install the latest versions.
For downgrading the PIP, execute the following command:
python -m pip install pip==18.1
Once you execute the command successfully, you will see the PIP version you have specified in the above command.
We have provided complete details on how to install PIP Linux and Windows. As mentioned earlier, PIP, or "preferred installer program," is a utility of Python used to handle Python packages. We have divided the procedure into two parts in which we have explained everything about installing PIP in both Linux and Windows. Ensure that your system meets the requirements because PIP is a pre-installed utility in the latest versions of Python.
People also read: