What is PIP?

PIP stands for “Pip Installs Packages”.

It is the official package manager for Python, used to install and manage external libraries that are not included with the standard Python distribution.



Why Use PIP?



How to Check if PIP is Installed

Open your terminal or command prompt and type :

pip --version


Installing a Package

pip install package_name

Example

pip install requests


Uninstalling a Package

pip uninstall package_name

Example

pip uninstall numpy


List All Installed Packages

pip list


Upgrade a Package

pip install --upgrade package_name

Example

pip install --upgrade pandas


Requirements File (for Project Dependencies)

To install all packages listed in a requirements.txt file :

pip install -r requirements.txt

Example contents of requirements.txt :

numpy==1.24.3
pandas>=1.3.0
requests


Summary


Task Command Example
Install a package pip install flask
Uninstall a package pip uninstall flask
Upgrade a package pip install --upgrade flask
List installed packages pip list
Install from file pip install -r requirements.txt


Practice Python Code Here: