Skip to content

Instantly share code, notes, and snippets.

@prehensilecode
Last active April 18, 2025 00:54
Show Gist options
  • Save prehensilecode/bec508685871371052c5c92c0a46ad6e to your computer and use it in GitHub Desktop.
Save prehensilecode/bec508685871371052c5c92c0a46ad6e to your computer and use it in GitHub Desktop.
Re-install all pip packages retaining the same version
#!/bin/bash
# tested on pip 25.0.1
# XXX this is probably not a good idea
for pkg in $( python3 -m pip list | tail -n+3 | awk '{print $1 "==" $2}' )
do
python3 -m pip install -U --force-reinstall "${pkg}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment