Python - pip cheatsheet
General parameters
| Parameter | Description |
|---|---|
-v, --verbose |
verbose mode (more output) |
-q, --quiet |
quiet mode (less output) |
-h, --help |
help |
-V, --version |
display version info |
--isolated |
ignore environment variables and user config |
--log PATH |
log file |
--proxy |
PROXY USER:PSWD@SERVER:PORT |
--retries X |
retry connection X times |
--timeout SECONDS |
try for X seconds before retry |
--cache-dir DIR |
cache directory |
--no-cache-dir |
disable cache |
--disable-pip-version-check |
do not check Pip version |
--cert PATH |
path to secondary CA bundle |
--client-cert CERT |
path to SSL certificate |
--trusted-host HOSTNAME |
consider the host trusted |
List and search
List
| Command | Description |
|---|---|
pip list |
list packages |
pip list -o, pip list --outdated |
list outdated packages |
-u, --uptodate |
list current packages |
-e, --editable |
list editable items |
-l, --local |
list local virtualenv packages |
--user |
list user-site packages |
--pre |
include developmental packages |
-i URL, --index-url URL |
PyPI URL |
--extra-index-url URL |
additional package repos |
--no-index |
ignore package index |
-f URL, --find-links URL |
search for archives at the URL |
--allow-external PKG |
allow package installation |
--allow-all-external |
allow installing externally hosted packages |
--allow-unverified PKG |
install insecure package |
--process-dependency-links |
process links for dependencies |
Show
| Command | Description |
|---|---|
pip show PKG |
display package info |
pip show -f, pip show --files |
list package’s files |
Search
| Command | Description |
|---|---|
pip search KEYWORD |
search PyPI for keyword |
pip search --index URL |
repository to search |
Install, Freeze and uninstall
Install
| Command | Description |
|---|---|
pip install PKG |
install package |
pip install PKG==1.0 |
install specific version |
pip install 'PKG>=1.0' |
at least, install version X |
pip install -r FILE, pip install --requirement FILE |
install listed packages in the requirements file |
pip install -b DIR, pip install --build DIR |
directory for building packages |
pip install -t DIR, pip install --target DIR |
install in directory |
pip install -d DIR, pip install --download DIR |
download only |
pip install -U, pip install --upgrade |
update listed packages |
pip install --force-reinstall |
re-install packages when updating |
pip unstall -I, pip install --ignore-installed |
re-install |
pip install --no-deps |
do not install dependencies |
pip install --egg |
install as an Egg |
pip install --compile |
compile to *.py to *.pyc |
pip install --no-compile |
do not compile |
pip install --no-use-wheel |
do not use wheels |
pip install --pre |
include developmental versions |
pip install --no-clean |
do not clean build directories |
pip install -i URL, pip install --index-url URL |
get PyPI URL |
pip install --extra-index-url URL |
get additional URLs |
pip install --no-index |
only use --find-links URLs |
pip install -f URL, pip install --find-links URL |
parse links for archives |
pip install --allow-external PKG |
install a 3rd-party package |
pip install --allow-all-external |
install 3rd-party packages |
pip install --allow-unverified PKG |
install unverified package |
pip install --process-dependency-links |
process links for dependencies |
Freeze
| Command | Description |
|---|---|
pip freeze |
generate requirements file |
pip freeze -r FILE, pip freeze --requirement FILE |
use the order given in the file |
pip freeze -f URL, pip freeze --find-links URL |
URL for finding packages |
pip freeze -l, pip freeze --local |
only list virtualenv packages |
pip freeze --user |
only list user-site packages |
Uninstall
| Command | Description |
|---|---|
pip uninstall PKG |
uninstall/remove package |
pip unistall -r FILE, pip unistall -requirement FILE |
uninstall packages listed in requirements file |
pip uninstall -y, pip uninstall --yes |
assume “yes” for questions |