Sitemap
Shankar Duraisamy

Shankar Duraisamy

Python Package Manager PIP

2 min readJul 15, 2024

Introduction:

When you install Python, it comes up with a collection of default packages called Python standard library. It solves many problems while coding, but it might only solve some of them. To solve issues related to projects we need external libraries which are not part of standard libraries. PIP provides the interface to install and manage these libraries or packages. PIP looks for packages in PYPI and installs them on your local machine. Pip will install any other packages in which a module or package is required.

PIP in Action:

Get Shankar Duraisamy’s stories in your inbox

Join Medium for free to get updates from this writer.

To know the version of the pip

pip --version

To install the package using PIP

#pip install package_name
pip install sqlite3

To install a package with a specific version

#pip install package_name==version
pip install sqlite3==3 0.5.3

Pip will support the conditions while installing the package.

#pip install package_name>=lower_version<higher_version
pip install sqllite>=3.0.3.0 <3.0.5.4

We can add all the requirements to the requirements file and give it pip, it will install all at once.

#requirement.txt
pip install sqllite>=3.0.3.0 <3.0.5.4
panada
decouple==3.0.3.0
pip install -r requirements.txt

we can list the packages installed on the projects

pip list

We can freeze the requirement and take a snapshot of the projects related to the external packages.

pip freeze > req.txt

Upgrade a package

#pip install --upgrade package_name
pip install --upgrade sqllite

pip install -r requirements.txt --upgrade

Uninstall a package

# pip uninstall package_name
pip uninstall sqlite

Summary of the package

#pip show package_name
pip show sqlite

Check for broken dependencies

pip check

clear the pip cache

pip cache purge

Install a pip

python has a build-in package “ensurepip” which is designed to install pip

python -m ensurepip

--

--