Created
November 8, 2018 10:45
-
-
Save andrea137/fb0e7083e2acaa9bb323aab0254702ee to your computer and use it in GitHub Desktop.
A simple script to export all the conda/Anaconda environments at once. Useful for example to backup or to move conda/Anaconda from one directory to another (https://docs.anaconda.com/anaconda/user-guide/tasks/move-directory/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
. $HOME/miniconda3/etc/profile.d/conda.sh | |
mkdir conda_env_backups | |
cd conda_env_backups | |
conda info --envs | awk 'NR>2 {print $1}' > tmp_env_names | |
while read in; do | |
conda activate "$in" | |
conda env export > $in.yml | |
conda deactivate | |
done < tmp_env_names | |
rm tmp_env_names |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment