Loading Page Content...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
pip (a recursive acronym for "Pip Installs Packages") is the official package installer for Python. It downloads, configures, and manages third-party libraries published on the Python Package Index (PyPI)—the central public repository hosting hundreds of thousands of open-source Python packages.
When you write Python code, you don't need to build web servers, cryptographic algorithms, or image processors from scratch. Developers worldwide publish open-source solutions to PyPI (pypi.org). pip connects directly to PyPI, resolves dependency trees, compiles necessary binary wheels, and places packages into your environment's site-packages folder.
pippython -m pip ... rather than bare pip .... This guarantees that you are executing the exact pip installer linked to your currently active Python interpreter, preventing accidental installations into the wrong environment.You can specify exact versions or version boundaries using comparison operators:
-U or --upgrade)To cleanly remove a library from the active environment:
pip listDisplays a clean tabular overview of every package and installed version:
Output:
pip list --outdatedScans PyPI to report packages in your environment that have newer versions available:
pip showShows detailed package metadata, license, installation directory, and upstream/downstream dependency relationships:
Output:
pip Commands Cheat Sheet| Command | Purpose |
|---|---|
python -m pip install <pkg> | Installs the latest stable version of <pkg> |
python -m pip install <pkg>==1.2.3 | Installs an exact pinned version |
python -m pip install -U <pkg> | Upgrades <pkg> to latest release |
python -m pip uninstall <pkg> -y | Uninstalls <pkg> without asking confirmation |
python -m pip list | Lists all packages installed in current environment |
python -m pip show <pkg> | Displays metadata, license, location, and dependencies |
python -m pip check | Verifies installed packages have compatible dependencies |
If you have multiple versions of Python installed, running plain pip might target a different Python than python. Always use python -m pip install <package> to guarantee you target the active interpreter.
In production apps, unpinned dependencies can introduce breaking changes when upstream libraries update. Pin versions in production.
Use pip commands in your terminal to inspect installed package details, list packages in JSON format, and check for outdated dependencies.
pip stand for in Python?python -m pip install <pkg> preferred over simply running pip install <pkg>?pip to install an exact specific release of a package?In the next lesson, we will continue your intermediate Python journey with Requirements.txt (12: Virtual Environments & Pip).
Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
| Previous Lesson | Next Lesson |
|---|---|
| Creating Virtual Environments | Requirements.txt |
Test your understanding of this lesson with 5 questions. Each question has one correct answer.