我最近在我的Mac上安装了anaconda2.默认情况下,Conda配置为在我打开新的终端会话时激活基本环境.
我想要访问Conda命令(即我希望Conda的路径添加到我的$ PATH,Conda在初始化时会这样做,这很好).
但我通常不用python编程,我不希望Conda默认激活环境.
当第一次conda init从提示执行时,Conda将以下内容添加到我的.bash_profile:
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/geoff/anaconda2/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/geoff/anaconda2/etc/profile.d/conda.sh" ]; then
. "/Users/geoff/anaconda2/etc/profile.d/conda.sh"
else
export PATH="/Users/geoff/anaconda2/bin:$PATH"
fi
# fi
unset __conda_setup
# <<< conda initialize <<<
Run Code Online (Sandbox Code Playgroud)
如果我注释掉整个块,那么我就无法激活任何Conda环境.
我试图评论整个街区除外
export PATH="/Users/geoff/anaconda2/bin:$PATH"
Run Code Online (Sandbox Code Playgroud)
但是当我开始一个新会话并尝试激活一个环境时,我收到了以下错误消息:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. …Run Code Online (Sandbox Code Playgroud) 在我的 VS Code 终端中运行 node 时出现此错误,除了我尝试在 CMD 中运行相同的东西并且它在那里工作但不在 VS Code 终端中:

node: The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ node
+ ~~~~
+ CategoryInfo : ObjectNotFound: (node:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)