This cheat sheet provides a comprehensive list of `pip` commands for package installation, removal, information retrieval, and management. It covers advanced options, environment management, security checks, and troubleshooting techniques. The document serves as a quick reference for users to efficiently manage Python packages using `pip`.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
50 views
PIP Commands
This cheat sheet provides a comprehensive list of `pip` commands for package installation, removal, information retrieval, and management. It covers advanced options, environment management, security checks, and troubleshooting techniques. The document serves as a quick reference for users to efficiently manage Python packages using `pip`.
● List Installed Packages: pip list ● List Outdated Packages: pip list --outdated ● Search PyPI for Packages: pip search search_query
4. Package Versions and History
● Check a Specific Package's Available Versions: pip install package_name==
● View Installation History: pip freeze ● Save Installed Packages to Requirements File: pip freeze > requirements.txt
5. Managing Package Sources
● Install from a Specific Source: pip install -i https://pypi.org/simple/
package_name ● Install from a Git Repository: pip install git+https://github.com/user/repo.git ● Install from a Local Directory: pip install /path/to/directory
● Force Reinstall a Package and Dependencies: pip install --force-reinstall package_name ● Upgrade a Package and its Dependencies: pip install --upgrade package_name
7. Environment and Configuration
● Using Virtual Environments: (Typically used with virtualenv or venv)
● Configuration with pip.conf: (Edit pip.conf for custom configuration) ● Check pip Configuration: pip config list
● Choose Python Version: pip2 or pip3 for specific Python versions ● Install with Compile Option: pip install --compile package_name ● Use Wheel to Install: pip install --use-wheel package_name
9. Handling Requirements Files
● Compile a Requirements File: pip-compile
● Upgrade All Packages in Requirements File: pip install -r requirements.txt --upgrade ● Generate a requirements file from an environment: pip freeze > requirements.txt
● List All Available Commands: pip --help ● Improve Install Speed: pip install package_name -vvv ● Verbose Mode for More Output: pip install --verbose package_name ● Use a Mirror: pip install -i https://<mirror_url> package_name