Mac anaconda创建了python 3.8 虚拟环境 以后,命令行提示
# To activate this environment, use
conda activate 3.8
# To deactivate an active environment, use
conda deactivate
然而 总是没有那么一帆风顺:
pendant@Pendant-MacBook-Air ~ conda activate 3.8
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
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'.
处理办法(centos ubuntu也是这么处理):
# 进入
source activate 你的环境名称
# 退出
source deactivate
执行上面两个命令以后 conda activate 也可用了 但是重新打开命令行窗口 conda activate 又不可用了,还是提示需要 conda init 。
conda init 会自动创建一些配置,看个人选择,如果想用 conda activate 就执行conda init 。 不执行 conda init 就可以用 source activate 环境名称 来激活