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 pip --version Example output shows the pip version and the Python interpreter it is associated with.

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

Install a package pip install package_name To install a specific version, use: pip install package_name==version To install a wheel file directly: pip install file_name.whl 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 pip install --upgrade pip If pip reports a newer version, run the command shown in the warning to update.

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

Batch install from a requirements file pip install -r requirements.txt Uninstall a package pip uninstall package_name List installed packages pip list To see which packages have newer releases available: pip list -o The article also includes a sample requirements.txt snippet showing package names and versions.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

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

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.