“pip3 list –outdated” shows us all installed packages that are currently out of date.
pip3 list --outdated
Sample Output
Package
------------------
certifi
h11
httpcore
importlib-metadata
lit
...
xargs –update, excluding the “Packages” and “——…” header lines
sudo pip3 list --outdated | \
awk -F" " '{ print $1 }' | \
grep -v "Package\|------------------" | \
xargs sudo pip3 install --upgrade
And as a one-liner:
sudo pip3 list --outdated | awk -F" " '{ print $1 }' | grep -v "Package\|------------------" | xargs sudo pip3 install --upgrade