In this article, we will discuss what is PIP, and how to install, upgrade, and uninstall packages using Python PIP. So before starting and using it, let us understand what is a Python PIP.
What is Package in Python?
Package refers to a distribution of Python code that includes one or more modules or libraries. These packages are typically published on the Python Package Index (PyPI) and can be easily installed using pip. Python packages may contain modules, sub-packages, and additional resources such as documentation and data files.
What is Python PIP?
Python PIP is the package manager for Python packages. We can use PIP to install packages that do not come with Python. The basic syntax of PIP commands in the command prompt is:
pip 'arguments'
How to Install Python PIP?
Python PIP comes pre-installed on 3.4 or older versions of Python. To Check if PIP is Installed or not type the below command in the terminal.
pip --version
This command will tell the version of the Pip if it is already installed in the system.

Checking Python PIP version
If you do not have PIP installed on your system refer to the below articles.
How to Install Package with Python PIP
We can install additional packages by using the Python pip install command. Let’s suppose we want to install the Numpy using PIP. We can do it using the below command.
Syntax:
pip install numpy
Example 1: When the required package is not installed.

Using Python PIP to install a new package
Example 2: When the required package is already installed.

Using Python PIP to install an existing package
Specifying Package Version using Python PIP
We can also install the package of a specific version by using the below command.
Syntax:
pip install package_name==version
This will install the package with the specified version
Display Package information using Python PIP
We can use the Python pip show command to display the details of a particular package.
Syntax:
pip show numpy
Example:

Display package information using Python PIP
Note:
- Requires column shows the dependencies required by the NumPy package
- Required by shows the packages that require NumPy
Get a list of locally installed Python Modules using Python PIP
The Python pip list command displays a list of packages installed in the system.
Syntax:
pip list
Example:

Getting a list of locally installed modules using Python PIP
Uninstall Packages with Python PIP
The Python pip uninstall command uninstalls a particular existing package.
Syntax:
pip uninstall numpy
Example:

Uninstall package with Python PIP
Note: The PIP uninstall command does not uninstall the package dependencies. If you want to remove the dependencies as well then you can see the dependencies using the pip show command and remove each package manually.
Search Packages with Python PIP
We can search for a particular existing package using the Python pip search command.
Syntax:
pip search numpy
Example:

Search package with Python PIP
Using Requirement files with Python PIP
Let’s suppose you want more than one package then instead of installing each package manually, you can install all the modules in a single go. This can be done by creating a requirements.txt file. Let’s suppose the requirements.txt file looks like this:

requirements.txt
Syntax:
pip install -r requirements.txt
Example:

Using requirements file to install packages with Python PIP
Listing additional Packages with Python PIP
The Python pip freeze command is used to list packages that don’t come pre-installed with Python.
Syntax:
pip freeze
Example:

Listing additional packages with Python PIP
Listing Outdated Packages with Python PIP
Python pip list –outdated command is used to list all the packages that are outdated. This command cross-checks the installed package information with the PIP repository.
Syntax:
pip list --outdated
Example:

Listing outdated packages with Python PIP
Upgrading Packages with Python PIP
Python pip install –user –upgrade is used to update a package.
Syntax:
pip install --user --upgrade package_name
Example:

Upgrading packages with Python PIP

Upgrading packages with Python PIP
We can also upgrade any package to a specific version using the below command.
pip install --user --upgrade package_name==version
Downgrading Packages with Python PIP
the Python pip install –user command is used to downgrade a package to a specific version.
Syntax:
pip install --user package_name==version
Example:

Downgrading packages with Python PIP
Similar Reads
C Vs Python
C: C is a structured, mid-level, general-purpose programming language that was developed at Bell Laboratories between 1972-73 by Dennis Ritchie. It was built as a foundation for developing the UNIX operating system. Being a mid-level language, C lacks the built-in functions that are characteristic o
4 min read
Python 3 basics
Python was developed by Guido van Rossum in the early 1990s and its latest version is 3.11.0, we can simply call it Python3. Python 3.0 was released in 2008. and is interpreted language i.e it's not compiled and the interpreter will check the code line by line. This article can be used to learn the
10 min read
ascii() in Python
Python ascii() function returns a string containing a printable representation of an object and escapes the non-ASCII characters in the string using \x, \u or \U escapes. It's a built-in function that takes one argument and returns a string that represents the object using only ASCII characters. Exa
3 min read
Python Functions
Python Functions is a block of statements that return the specific task. The idea is to put some commonly or repeatedly done tasks together and make a function so that instead of writing the same code again and again for different inputs, we can do the function calls to reuse code contained in it ov
11 min read
Python Arrays
Lists in Python are the most flexible and commonly used data structure for sequential storage. They are similar to arrays in other languages but with several key differences: Dynamic Typing: Python lists can hold elements of different types in the same list. We can have an integer, a string and even
10 min read
Python open() Function
The Python open() function is used to open internally stored files. It returns the contents of the file as Python objects. Python open() Function SyntaxThe open() function in Python has the following syntax: Syntax: open(file_name, mode) Parameters: file_name: This parameter as the name suggests, is
3 min read
Python vs Cpython
Python is a high-level, interpreted programming language favored for its readability and versatility. It's widely used in web development, data science, machine learning, scripting, and more. However, Cpython is the default and most widely used implementation of the Python language. It's written in
4 min read
History of Python
Python is a widely used general-purpose, high-level programming language. It was initially designed by Guido van Rossum in 1991 and developed by Python Software Foundation. It was mainly developed to emphasize code readability, and its syntax allows programmers to express concepts in fewer lines of
5 min read
Python Modules
Python Module is a file that contains built-in functions, classes,its and variables. There are many Python modules, each with its specific work. In this article, we will cover all about Python modules, such as How to create our own simple module, Import Python modules, From statements in Python, we
7 min read
Python print() function
The python print() function as the name suggests is used to print a python object(s) in Python as standard output. Syntax: print(object(s), sep, end, file, flush) Parameters: Object(s): It can be any python object(s) like string, list, tuple, etc. But before printing all objects get converted into s
2 min read