pip & Package Management
pip is Python's package installer. It downloads packages from PyPI (the Python Package Index) and installs them into your environment.
Basic pip Commands
# Install a package
pip install requests
# Install specific version
pip install "requests==2.31.0"
# Install minimum version
pip install "requests>=2.28"
# Uninstall
pip uninstall requests
# Upgrade
pip install --upgrade requestsListing & Searching
# List installed packages
pip list
pip list --outdated
# Show package info
pip show requests
# Search (deprecated, use pypi.org)
pip search requestsrequirements.txt
# Generate
pip freeze > requirements.txt
# Install from file
pip install -r requirements.txt
# requirements.txt example:
requests==2.31.0
flask>=3.0.0
numpy>=1.24,<2.0
pytestpip in Python Scripts
import subprocess, sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "requests"])Useful Packages by Category
"""
Web: flask, fastapi, django, requests, httpx
Data: pandas, numpy, polars, scipy
ML: scikit-learn, tensorflow, torch, transformers
CLI: click, typer, rich, argparse
Testing: pytest, hypothesis, coverage
"""