Fundamentals 6 min read

10 Practical pip Tips for Managing Python Packages

This article introduces ten essential pip techniques—including installation, upgrading, version-specific installs, uninstalling, checking dependencies, using domestic mirrors, downloading without installing, and batch installing from requirements files—to help Python developers efficiently manage their packages.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
10 Practical pip Tips for Managing Python Packages

Python's pip tool is included with Python 3.4+ and 2.7.9+, allowing users to install, upgrade, uninstall, and manage packages directly from the command line.

Installation

Run py -m ensurepip --upgrade or download get-pip.py from https://bootstrap.pypa.io/get-pip.py and execute python get-pip.py .

Basic usage

Typing pip in the terminal displays the help information.

Upgrade pip

Use pip install --upgrade pip or the short form pip install -U pip .

Install a specific version

Example: pip install matplotlib==3.4.1 installs the specified version of the package.

Uninstall or update a package

Uninstall a package with pip uninstall package_name . Update a package with pip install --upgrade package_name or pip install -U package_name .

Show package information

Display detailed information using pip show -f requests , which lists metadata and installed files.

List outdated packages

Run pip list -o to see which installed packages have newer releases available.

Check for compatibility issues

Execute pip check (optionally with a package name) to detect dependency conflicts among installed packages.

Use domestic mirrors

Speed up downloads by specifying a mirror, e.g., pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ package_name . Common Chinese mirrors include Tsinghua, Alibaba Cloud, USTC, Huazhong University of Science and Technology, Shandong University of Technology, and Douban.

Download without installing

Fetch package files without installing using pip download package_name -d "path" , for example pip download requests -d "." saves the files to the current directory.

Batch install from requirements.txt

Create a requirements file with pip freeze > requirements.txt and install all listed packages via pip install -r requirements.txt .

PythonUpgradeInstallationPackage Managementrequirements.txtpipmirrors
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.