Hello. "Batch update with pip" has been slightly expanded to check for bulk updates (``` [upgrade all? (Y / n)] `` I made it into a shell script with `).
pip_upgrade_all.sh
#!/bin/sh
PIP="pip"
OUTDATED=$(${PIP} list --format=columns --outdated | awk 'NR>=3 {print $1}')
[ -z "${OUTDATED}" ] && exit $?
echo "${OUTDATED}"
echo "[upgrade all? (y/n)]"
read -r KEYINPUT
if [ "${KEYINPUT}" = "y" ];then
echo "${OUTDATED}" | xargs ${PIP} install --upgrade
fi
exit $?
The one-liner that runs without confirmation is
$ pip list --format=columns --outdated | awk 'NR>=3 {print $1}' | xargs pip install --upgrade
Recommended Posts