Skip to content

Instantly share code, notes, and snippets.

@princebot
Last active November 11, 2015 22:08
Show Gist options
  • Save princebot/f0f9b1ad1b0c982d8cc9 to your computer and use it in GitHub Desktop.
Save princebot/f0f9b1ad1b0c982d8cc9 to your computer and use it in GitHub Desktop.
# Bash function for updating all packages installed with either `pip` or
# `conda` in the current Python virtualenv or conda environment.
pyupdate() {
# If we're in a conda environment, update all packages conda installed.
which conda 2>/dev/null && conda update -y --all
# After we're done with conda, if we have pip, update pip then update any
# packages installed with pip.
if which pip 2>/dev/null; then
pip install -U pip
pip freeze --local \
| awk -F'==' '{print $1}' \
| xargs pip install -U
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment