How to install Python pip package manager – with example

  • Reading time:16 mins read

What is the Python pip package manager?

Pip is a package manager that is used to install and manage software packages and modules found in the Python Package index or any other indexes. 

Packages such as the request library are officially packaged and managed while others may have been published by individuals.

Now if you have ever written programs in Python chances are that you have imported a package or library at the top of your program at some point.

Unless the module you have imported into your Python code is built into the standard Python library, it must be downloaded.

Now the best way to do so in Python is by using the PIP package manager.  Common libraries such as the Pandas Library, a common data science library and even bigger frameworks such as Flask and Django can also be installed via the PIP package manager.

 

How to install the Python pip package manager

Python3 is bundled with the Python package manager, therefore installing python guarantees that the PIP package manager is also installed alongside.

To verify that indeed the pip package manager has been installed in our system we just need to run the command below in the terminal.

pip --version

In the output above it is evident that version 21.2.3 of the pip package manager is installed in the system, furthermore, it is linked to Python3.

 

install python pip

Alternative ways to install Python pip

PIP package manager can also be installed from the source by visiting the URL (https://bootstrap.pypa.io/get-pip.py).

Now copy the contents in this site to another file and save the file as get-pip.py. Proceed to open the windows terminal as the admin and navigate to the file location that we have just saved and run the command below.  

python get-pip.py install

C:\Users\tonyloi\Documents>python get-pip.py install Defaulting to user installation 
because normal site-packages is not writeable Collecting install   Downloading install-1.3.4-
py3-none-any.whl (3.1 kB) Collecting pip   Using cached pip-21.3.1-py3-none-any.whl (1.7 
MB) Collecting wheel   Downloading wheel-0.37.0-py2.py3-none-any.whl (35 kB) Installing 
collected packages: wheel, pip, install   WARNING: The script wheel.exe is installed in 'C:
\Users\tonyloi\AppData\Roaming\Python\Python310\Scripts' which is not on 
PATH.   Consider adding this directory to PATH or, if you prefer to suppress this warning, 
use --no-warn-script-location.   Attempting uninstall: pip     Found existing installation: pip 
21.3.1     Uninstalling pip-21.3.1:       Successfully uninstalled pip-21.3.1   WARNING: The 
scripts pip.exe, pip3.10.exe and pip3.exe are installed in 'C:\Users\tonyloi\AppData\Roaming
\Python\Python310\Scripts' which is not on PATH.   Consider adding this directory to PATH 
or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully 
installed install-1.3.4 pip-21.3.1 wheel-0.37.0
 

This will install the Python pip package manager in the system and also inform us how to add this into the PATH under the system variable so that we will be able to run the pip package manager from anywhere in the system.  

 

python pip

Verifying the installation of the Python pip

Once the pip Python package manager has been installed you can easily verify that it has been properly installed by running the command below in the terminal on a Windows operating system.

pip --version

 

Upgrading the Python pip package manager

Installing a newer version of the pip package manager can be easily done by running the command below in the Python command prompt.  

python -m pip install --upgrade
 

python pip

Using the Python pip package manager to install the requests library

The request library is the standard library for making HTTP requests in Python.  It can also be installed using the pip package manager by running the command below.  

pip install requests

Once we have installed the library, we can now import the library at the top of our code and make our requests to the server, interact with services and consume data.

Summary

If you’d like to see more programming tutorials, check out our Youtube channel, where we have plenty of Python video tutorials in English.

In our Python Programming Tutorials series, you’ll find useful materials which will help you improve your programming skills and speed up the learning process.

Programming tutorials

Would you like to learn how to code, online? Come and try our first 25 lessons for free at the CodeBerry Programming School.

 
 

Learn to code and change your career!

100% ONLINE

IDEAL FOR BEGINNERS

SUPPORTIVE COMMUNITY

SELF-PACED LEARNING

Not sure if programming is for you? With CodeBerry you’ll like it.