List of content you will read in this article:
Pip is a great tool for installing and managing Python packages. Pip is a package manager that allows the installation of third-party software packages for Python. Pip is among the most powerful package managers for Python and has become quite popular because it is quite easy to use. Even though most Python versions come pre-loaded with pip, this guide will teach to manually install pip, review its version, and use some simple pip commands. Pip is a preinstall package that comes with python to only update python or package versions. Pip does not play any role in the installation or uninstallation of Python.
What is Python?
Python is an open-source programming language that allows software development and even makes a great choice for web development. Also, one can use Python on several popular operating systems, including Windows, Linux, and iOS.
Pip Installation Guide
Here are some simple steps that guide to install pip on the system:
Step 1: Verify if Pip has been installed already.
By default, pip comes integrated with almost all the latest versions of Python. To check if pip has already been installed on the system, open a command prompt and run the following command:
The user will get a message showing details of how to use pip if installed on the system. If pip is not installed, there would be an error in the command prompt window; the output will signify that ”pip can’t be found” on the system.
Step 2: Confirm the installation of Python.
The easiest way to verify the installation of Python is to open the command prompt on the Windows system and run the command
python. If Python is installed, the output would be similar to the one shown below.
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
For further details, type "support," "copyright," "credits," or "license."
However, if you receive an output message like the below:
Python is not recognized as an internal or external command, operable program, or batch file.
It means that either Python isn't installed or the variable path for Python isn't configured properly. If the variable path is not set, you can either run Python from the folder where it is installed or change your device variables to allow Python to run from anywhere on the system.
You can easily install the latest version of Python by downloading the Python installer from its official website.
Step 3: Pip Installation on Windows
Once checked the Python is correctly configured on your system, proceed with downloading the pip package manager. Here are a few steps to follow:
- get-pip.py will be there in a directory of the system.
- Open a command prompt and go to the directory where the get-pip.py installer is located on your system.
- Execute the following command:
Pip must now be successfully installed. In case of an error message "file not found", double-check the file's directory path. The dir command displays the contents of a folder in its directory. It is worth noticing that Python 2.7.9+ and Python 3.4+ come with pip loaded by default. When Pip is enabled, it also sets up the virtualenv and pyvenv virtual environments.
Step 4: Check the pip Version and Verify the Installation
To check if pip is installed correctly, run the following command in the command prompt (for Windows) or Terminal (for Linux and macOS):
You will get an output similar to the one shown below:
pip18.0 from c:\users\administrator\appdata\local\programs\python\python37\lib\site-package\pip (python 3.7)
Step 5: Managing Python Packages with pip
Use pip to handle functionalities once it's installed and configured in the system. To get a quick overview of the functions and syntax available for Pip, open a command prompt and type:
Step 6: Configuration
% HOME%\ pip\pip.ini is the location on your system where you'll find the PIP setup file.
Pip also has a user configuration file from the past. This file is found in the system at the following path:
You may also use the environment parameter to set a specific pathway for this config file through:
If you have an older version of Python already installed, find out how to update Python.
How to Upgrade pip?
To take advantage of the new features and security patches, update pip from time to time, just like any other software. While pip can automatically update itself, it’s important for you to know how you can manually update pip.
Simply open Command Prompt on Windows system and execute the following command:
python -m pip install --upgrade pip
This will uninstall the current version of pip on the system and replace it with the latest version.
How to Downgrade pip?
If there is a need to revert to a previous version of pip due to compatibility issues, one can easily do it from the Command Prompt. Open a command prompt and type the following command to downgrade to a custom version of pip (specify the version of pip).
python -m pip install pip==18.0 (or any other version)
Pip will be downgraded to the specified version. After the execution of the above command, one can check the pip version with this command:
We hope we have successfully made you understand how to install pip on your system. If you are working with Python development, pip can come in handy for managing various python library packages. Also, you can easily choose a pip version that you want to work with.