机型:M1 Macbook pro
版本:Python 3.9/3.8 Conda:conda forge
在配置完成后,使用
conda activate python38
想要一键切换Python环境时,遇到报错
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
解决方案:
首先运行以下指令,查询当前环境所在位置
conda info | grep -i 'base environment'
运行以下指令,将其中的 *** 更换成上面的查询结果,同样适用于其他conda
source ***/etc/profile.d/conda.sh
再次执行
conda activate python38
activate
可以正常使用
➜ ~ conda activate python38
(python38) ➜ ~