Python PIP


What is Python PIP?


Python programming has different software packages. We need to use these packages during our coding activities. To use these packages a management system is needed. In this lesson, we will focus on this package management system, we will learn what is Python PIP.


First of all, let’s answer the question, what is Python PIP. It is basically a packet management system with which we can install and manage software packages that we will use with python. It is also written by Python. In other words, with Python PIP, we connect to an online repository that includes different packages and from this repository, we can install these packages.


By default, PIP is installed if you are using Python 3.4 or later. If you are using other versions, you should do Python pip install to use it for your packet management operations.


We can easily check Python Package Mangement System in our laptop. Basically, in the command line of the windows, you can go through the python folder. Under this folder you can use “pip –version” command to see if it is installed or not. If PIP is installed in your system, it will return with its version.


C:\Users\ipcisco>pip --version

pip 20.0.2 from C:\Users\ipcisco\anaconda3\lib\site-packages\pip (python 3.7)


As you can see, on my laptop, pip 20.0.2 is installed.


Python PIP Install


After learning what is Python PIP, now let’s learn how to install it. To use PIP, first of all it must be installed in your system. As I mentioned before, if you are using Python 3.4 or higher version, it is installed by default. But if it is not installed, how can you do Python PIP install?


To install PIP, you can visit download it from their website. After downloading it, it is easy to install like other programs.


PIP Package Management

How to Install a Packet With Python PIP?


If you have Python PIP in your system by default or if you installed it, then you can easily download any package from pip repository and use these packages. To do this, you should be in the same directory with python in your windows system. After that, you will use “pip install” command with the package name that you would like to install. For example, let’s say that our package name is xyz. To install it on our system, we will use the below command:


C:\Users\ipcisco>pip install xyz


After this command, this package will be installed on to our system.



Listing Installed Packages


We can list the packages that are installed on our system with a pip command. This command is “pip list” command. With this command, before installing any package, we can check that if it already exists.


The output of this command gives the package name and its version basically. You can find the first 10 apckages installed on my laptop for python. The list is a little long, so I put only the first ten line.


C:\Users\ipcisco>pip list

Package                            Version
---------------------------------- -------------------
alabaster                          0.7.12
anaconda-client                    1.7.2
anaconda-navigator                 1.9.12
anaconda-project                   0.8.3
argh                               0.26.2
asn1crypto                         1.3.0
astroid                            2.3.3
astropy                            4.0
atomicwrites                       1.3.0
attrs                              19.3.0


How to Uninstall a Packet With Python PIP?


If you would like to uninstall a package with Python Package Mangement System, you should use the reverse of this command. This command is “python uninstall xyz”. After using this command, xyz package will be removed on your system.


C:\Users\ipcisco>pip uninstall xyz


After this command, system will expect a confirmation from you. If you confirm this uninstall process, the package will be removed from your system.


How to Use A Package?


After Python PIP install, you are ready to sue your new package. You can import it to your code and then you can use the functions, methods etc. in this package. To do this, we will use the same code that we use during a module addition. This code is “import”.


To import the above package xyz to our code, we use “import xyz” at the beginning of our code. After this addition, we can use all the functions in this package.



Last Word On PIP


Python Package installation system is really important mechanism that you will use too much for your python coding projects. In this lesson, we have focused on the basic of PIP and we have answered what is python PIP, Why we use PIP in Python, How to install packages, how to use them, how to uninstall packages etc.

Back to: Python Programming Course

Leave a Reply

Your email address will not be published. Required fields are marked *

Python Programming Course