aboutsummaryrefslogtreecommitdiff
path: root/cheat/.cheat/pip
blob: 9b438ea998cc9e37d29b705c4a7ddfc6c7d36d4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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>