I know how to export a specific conda environment:
conda activate myenv
conda env export > myenv.yaml
But how can I automatically export all created conda environments (in separate yaml files, whose name corresponds to the name of the environment)?
You don't need to activate the environment. conda env export accepts the argument -n <env name> which you can combine with a for loop over the output of conda list:
for env in $(conda env list | cut -d" " -f1); do
if [[ ${env:0:1} == "#" ]] ; then continue; fi;
conda env export -n $env > ${env}.yml
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With