Skip to content

Instantly share code, notes, and snippets.

@avarun42
Created January 15, 2019 08:29
Show Gist options
  • Select an option

  • Save avarun42/12b096d60ef00ffe3bd6a6bf4b501879 to your computer and use it in GitHub Desktop.

Select an option

Save avarun42/12b096d60ef00ffe3bd6a6bf4b501879 to your computer and use it in GitHub Desktop.
Uninstall all pip-installed python packages from a conda environment
# Linux
conda list | grep '<pip>' | tr -s [:blank:] | cut -d' ' -f1 | xargs -d'\n' pip uninstall -y
# On macOS must install GNU findutils first in order to get custom delimiter functionality
# brew install findutils
# conda list | grep '<pip>' | tr -s [:blank:] | cut -d' ' -f1 | gxargs -d'\n' pip uninstall -y
@amodig
Copy link

amodig commented Aug 5, 2024

Nice! Small updated required: instead of grep '<pip>' we need e.g. grep 'pypi'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment