pip Basics
# Install a package
pip install flask
# Install specific version
pip install flask==3.0.0
# Install with version constraints
pip install "flask>=2.0,<3.0"
# Upgrade a package
pip install --upgrade flask
# Uninstall a package
pip uninstall flask
# List installed packages
pip list
# Show package info
pip show flask
Requirements Files
# Generate requirements.txt
pip freeze > requirements.txt
# Install from requirements.txt
pip install -r requirements.txt
# Example requirements.txt:
# flask==3.0.0
# requests>=2.31.0
# python-dotenv~=1.0.0
Troubleshooting
# Permission errors
pip install --user flask
# SSL errors
pip install --trusted-host pypi.org flask
# Check which Python pip is using
pip --version
Modern Alternatives
- pip-tools: Pin exact versions
- Poetry: Dependency management + virtual environments
- uv: Extremely fast pip replacement in Rust
- pipx: Install CLI tools in isolated environments
Ready to Level Up Your Coding Skills?
Join Coderz Club and learn to code with challenges, battles, and an AI mentor.
Join Coderz Club Free →