pip
is a package manager that is written in Python. It is used for the installation of Python packages. All python packages are stored in an online repository called Python package index – pip
connects to this online repository and installs the packages on the local system.
All Python distributions greater than the python 2.7.9
version has pip pre-installed. pip3
is pre-installed on python 3.4
and all latest versions. The latest version of pip is pip20
.
pip
# The below command is used to check the version of pip installedpython -m pip --version
pip
# The following command is used to upgrade pip to latest versionpip install --upgrade pip
pip
listThe pip list is a command that can be used to list available packages:
pip list
pip
We can use the pip install
command to install any package:
pip install <package-name>
pip
To uninstall any package, use the following command:
pip uninstall <package_name>
A file containing all the package names can also be used to install Python packages in batches.
Suppose we have a file (Required_Packages.txt
) that lists of all the packages to be installed. We can install all these packages and their dependencies using:
pip install -r Required_Packages.txt
The Required_Packages
file can be created using the
The command used to create the requirement file is:
pip freeze > Required_Packages.txt
pip
The search command can be used to find a specific package in the list of available packages.
The command used to search a package is:
pip search numpy