PIP is a package manager for python packages or modules, it is used to install the additional libraries and packages that are not part of the standard Python library.
How to install pip?
pip comes pre-installed on the Python versions 3.4 or older. We can check if pip is installed by using the following command in the console:
pip --version
If pip is already available in the system, the respective pip version will be displayed.
If pip is not installed in the system then we can download and install it from this page: https://pypi.org/project/pip/
What is a Package?
A package contains all the files we need for a module.
Modules are Python code libraries we can include in our project.
How to install package/module/library?
For example to install the numpy library we have to give following command-
pip install numpy
How to uninstall a package?
pip uninstall numpy
How to use package?
Once the package is installed we can use it by importing in our program as shown below-
import numpy as np
arr = np.array([1, 2, 3])
print(arr)
How to get list of installed packages?
To get the list of installed packages in your system use the following command-
pip list
Leave a Reply