Fundamentals 6 min read

A Comprehensive Guide to Using pip for Python Package Management

This article introduces pip, the Python package manager, explains how to check its version, view help, install, upgrade, list, and uninstall packages, manage requirements files, and understand different wheel types, providing essential commands and tips for effective Python dependency management.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
A Comprehensive Guide to Using pip for Python Package Management

pip is the default package manager for Python, enabling you to install, upgrade, list, and uninstall third‑party libraries from the PyPI repository.

Since Python 3.4, pip is bundled with every Python installation, so it is readily available on most systems.

Check pip version

<code>pip --version</code>

Example output shows the pip version and the Python interpreter it is associated with.

Get pip help

<code>pip help</code>

The help command lists all available sub‑commands such as install , uninstall , list , freeze , etc.

Install a package

<code>pip install package_name</code>

To install a specific version, use:

<code>pip install package_name==version</code>

To install a wheel file directly:

<code>pip install file_name.whl</code>

Wheel files are binary distributions defined by PEP 427 and replace the older .egg format. They come in three types:

Pure Python Wheel – contains only Python files and works on both Python 2 and 3.

Pure Python Wheel (no 2/3 support) – contains only Python files but lacks native 2/3 compatibility.

Platform‑specific Wheel – includes compiled extensions and is tied to a particular OS/architecture.

Upgrade pip itself

<code>pip install --upgrade pip</code>

If pip reports a newer version, run the command shown in the warning to update.

Export installed packages

<code>pip freeze &gt; requirements.txt</code>

This creates a requirements.txt file listing all installed packages with exact versions, useful for reproducing environments.

Batch install from a requirements file

<code>pip install -r requirements.txt</code>

Uninstall a package

<code>pip uninstall package_name</code>

List installed packages

<code>pip list</code>

To see which packages have newer releases available:

<code>pip list -o</code>

The article also includes a sample requirements.txt snippet showing package names and versions.

PythonCommand-linerequirementsPackage Managementpipwheel
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.