执行 conda init your_shell_name
之后,指定 shell 的启动脚本会被加入 conda 的配置,使得每次启动时都会花费时间激活 (base) 环境。比如对于 Powershell,被修改的是 profile.ps1
;对于 zsh,被修改的是 .zshrc
。但是大部分时候我们并不需要使用 conda,为了提高启动速度,我们可以采取以下两种方法之一【搬运自stackoverflow,不作翻译】
- Use sub-command conda config to change the setting.
conda config --set auto_activate_base false
In fact, the former conda config sub-command is changing configuration file .condarc. We can modify .condarc directly. Add following content into .condarc under your home directory,
auto_activate_base: false
- Set environment variable CONDA_AUTO_ACTIVATE_BASE in the shell's init file (.bashrc for bash, .zshrc for zsh), before the >>> conda initialize >>> block.
# !! IMPORTANT !! this must go *before* the conda init block
export CONDA_AUTO_ACTIVATE_BASE=false
To convert from the condarc file-based configuration parameter name to the environment variable parameter name, make the name all uppercase and prepend CONDA_. For example, conda’s always_yes configuration parameter can be specified using a CONDA_ALWAYS_YES environment variable.
The environment settings take precedence over corresponding settings in .condarc file.
正解
TudoStar 02-22