Simple bash script to export all Conda Virtual Environments

Stephen Cow Chau
1 min readDec 22, 2019

--

Given previous problem: https://medium.com/@stephencowchau/conda-troubleshoot-oserror-libiconv-so-2-5111ba2359ce

I have this idea to keep track of my virtual envs so later I can rebuild with less pain, here I build the bash shell script for that:

#!/bin/bashenv_array=$(eval "conda env list | cut -d ' ' -f1")
#echo $env_array

for env_name in ${env_array[@]}
do
if [ "$env_name" != "#" ]
then
command="conda env export -n $env_name > /path/to/$env_name.txt"
#echo $command
eval $command
fi
done

--

--

No responses yet