Python pip Package Manager Cheat Sheet
Command-line reference guide for pip. Learn to install, upgrade, uninstall, and manage Python packages and dependencies.
Installing & Managing Packages
Essential commands to acquire packages from the PyPI index and query local packages.
| Method | Syntax | Description |
|---|---|---|
| pip install | pip install <package> | Downloads and installs the specified package. |
| pip install --upgrade | pip install -U <package> | Upgrades the package to its latest available version. |
| pip uninstall | pip uninstall <package> | Uninstalls the specified package from the active python library path. |
| pip list | pip list | Lists all installed packages along with their version numbers. |
| pip show | pip show <package> | Displays detailed metadata information about a installed package. |
Dependency Tracking & Caches
Freezing configurations, environment files, and caching adjustments.
| Method | Syntax | Description |
|---|---|---|
| pip freeze | pip freeze | Outputs installed packages in requirements format (package==version). |
| pip install -r | pip install -r requirements.txt | Installs all dependencies listed in the specified text file. |
| pip check | pip check | Verifies that installed packages have compatible dependencies. |
| pip cache purge | pip cache purge | Clears the local downloaded wheel cache storage. |
Frequently Asked Questions
What is the difference between pip list and pip freeze?
pip list lists installed packages and their versions in a user-friendly format, while pip freeze prints them in the format package==version, suitable for writing to a requirements.txt file.
How do I isolate dependencies between different projects?
Use Python's built-in venv module to create a virtual environment, activate it, and run pip within that environment.
Keep Learning
Recommended Python Resources
Expand your knowledge with related interactive tutorials, cheat sheets, and code comparisons.
Python Loops
Learn how to use Python loops to iterate over data. Master for loops, while loops, break, continue, and loop best practices with interactive examples.
How to Install Python Packages Using pip
Learn how to install and manage third-party packages in Python using pip. Discover virtual environments, requirements.txt, and basic commands.
Python vs JavaScript: Which Programming Language is Best?
A comprehensive comparison between Python and JavaScript. Explore syntax differences, performance, use cases (backend vs frontend), and coding examples.