Python:解决conda activate报错: You may need to close and restart your shell after running ‘conda init‘

项目场景:

Pycharm -> 打开Terminal Shell -> conda切换环境 ->切换失败

问题描述

完整报错信息如下

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'.

按照它说的先退出并重启shell,再执行conda init并没有什么卵用…

原因分析:

没有成功退出环境

解决方案:

在conda已经新建成功环境的前提下,通过设置直接切换环境,再新建打开Terminal即可直接切换成功环境

在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qjyws/article/details/128773228