pip is the standard package manager for Python that is used for installing libraries and packages that are not available in the Python standard library.
Keep reading the article below to understand in detail about what is Python pip and how it works!
How to install pip in Python?
pip comes pre-installed in Python version 3.4 and above. Therefore, you don’t have to install it separately.
However, if you want to check which version of pip you have, then you can use the following command in your terminal:
You will get an output such as the one shown below which indicates that the currently installed pip version is 21.0.1.
pip 21.0.1 from c:\users\msi\appdata\local\programs\python\python38\lib\site-packages\pip (python 3.8)
Install Python packages using pip
Here’s the syntax for using pip to install the latest version of packages:
pip install package_name
For example, if you want to install latest version of Pandas, you can use the following syntax:
pip install pandas
You can also specify the version of the package you want to install using pip. For example, if you want the 1.2.2 version of Pandas, you can specify it in the following format:
pip install pandas==1.2.2
Helpful pip commands
You can print out all the packages installed using pip using the following command:
Also, if you need to see the information of packages you have installed in your system, you can do so using the following command:
pip show package_name
Here’s an example:
pip show pandas
This will give you an output such as:
Name: pandas Version: 1.1.3 Summary: Powerful data structures for data analysis, time series, and statistics Home-page: https://pandas.pydata.org Author: None Author-email: None License: BSD Location: c:\users\msi\appdata\local\programs\python\python38\lib\site-packages Requires: numpy, python-dateutil, pytz Required-by: seaborn, apache-airflow
Uninstall Python packages using pip
Finally, if you need to uninstall packages using pip, you can do so using the following command:
pip uninstall package_name
So, if you want to uninstall Pandas, you can simply do so by writing:
pip uninstall pandas
Hope this helps you understand what is Python pip and how it works. The detailed documentation of pip can be found on https://pip.pypa.io/en/stable/.