pip Overview
pip is the package installer for Python. It allows you to install and manage additional packages that are not part of the Python standard library. pip is included by default with Python installations since Python 3.4.
Key Features
- Package Installation: Install packages from PyPI and other indexes
- Dependency Management: Automatically installs dependencies
- Version Control: Install specific package versions
- Virtual Environment Support: Works with venv and virtualenv
- Requirements Files: Install from requirements.txt files
- Wheel Support: Faster installation with wheel packages
- Hash Checking: Verify package integrity before installation
Installation & Setup
Installation Steps:
- pip comes pre-installed with Python 3.4+
- To upgrade pip:
python -m pip install --upgrade pip - Verify installation:
pip --version - Configure pip if needed (index URLs, proxies, etc.)
- Consider using virtual environments for project isolation
Common Commands:
pip install
Install packages
pip freeze
Output installed packages
pip list
List installed packages
pip show
Show information about a package
Productivity Tips
Requirements Files
Use requirements.txt files to document and reproduce environments.
Virtual Environments
Always use virtual environments to isolate project dependencies.
Index URLs
Use --index-url to specify alternative package indexes.
pip cache
Leverage pip's cache to speed up repeated installations.