aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/cheat/pip
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-09-05 07:05:07 +0200
committerneodarz <neodarz@neodarz.net>2019-09-05 07:05:07 +0200
commite0c0d4b38cde20e2300e86b69414dd9851b47456 (patch)
tree5df65243447352a9637d1f783247bfd5ccff2ef4 /dotfiles/cheat/pip
parentdc45bf89a66ec6c8cd25cf5605deb853f6984705 (diff)
downloaddotfiles_dotdrop-e0c0d4b38cde20e2300e86b69414dd9851b47456.tar.xz
dotfiles_dotdrop-e0c0d4b38cde20e2300e86b69414dd9851b47456.zip
ooo
Diffstat (limited to 'dotfiles/cheat/pip')
-rw-r--r--dotfiles/cheat/pip34
1 files changed, 34 insertions, 0 deletions
diff --git a/dotfiles/cheat/pip b/dotfiles/cheat/pip
new file mode 100644
index 0000000..9b438ea
--- /dev/null
+++ b/dotfiles/cheat/pip
@@ -0,0 +1,34 @@
+# Search for packages
+pip search SomePackage
+
+# Install some packages
+pip install SomePackage
+
+# Install some package in user space
+pip install --user SomePackage
+
+# Upgrade some package
+pip install --upgrade SomePackage
+
+# Output and install packages in a requirement file
+pip freeze > requirements.txt
+pip install -r requirements.txt
+
+# Show details of a package
+pip show SomePackage
+
+# List outdated packages
+pip list --outdated
+
+# Upgrade all outdated packages, thanks to http://stackoverflow.com/a/3452888
+pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
+
+# Upgrade outdated packages on latest version of pip
+pip list --outdated --format=freeze | cut -d = -f 1 | xargs -n1 pip install -U
+
+# Install specific version of a package
+pip install -I SomePackage1==1.1.0 'SomePackage2>=1.0.4'
+
+# Best pratice to use pip
+# source: https://linuxfr.org/users/oliver_h/journaux/quelques-bonnes-pratiques-python-pour-2019
+python3 -m pip <same syntax as above>