Cleaning up conda environments

by on under blog
1 minute read

Often when I’m developing or debugging in Python I end up creating throw away conda environments. They will be to test some package installation or combination of packages and once I’ve finished I will probably never use them again.

Usually I accidentally leave these hanging around and end up with a cluttered conda env list.

Here’s a quick one liner to remove any environments with the words tmp, temp or test in them.

$ conda env list | grep 'tmp\|temp\|test' | awk '{ print $1 }' | xargs -n1 -d'\n' conda env remove -n
conda, python, hygine
Spotted a mistake in this article? Why not suggest an edit!
comments powered by Disqus