- 将下面代码 copy 到 shell profile 文件的最后(例如 ~/.zshrc )
- 然后 创建一个 .conda_config 文件在目录下
- 将 conda 环境名写入该文件(必须只包含环境名)
- source ~/.zshrc
- cd 到对应目录即可
cd() { builtin cd "$@" && 
if [ -f $PWD/.conda_config ]; then
    export CONDACONFIGDIR=$PWD
    conda activate $(cat .conda_config)
elif [ "$CONDACONFIGDIR" ]; then
    if [[ $PWD != *"$CONDACONFIGDIR"* ]]; then
        export CONDACONFIGDIR=""
        conda deactivate
    fi
fi }










