您的外壳尚未正确配置为使用'conda activate'



我在连续集成中运行以下命令(不是在机器上本地(:

conda env create -f python/env/foo.yml && conda init bash && conda activate foo

然而,我得到了以下错误:

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

Error: Process completed with exit code 1.

既然是CI,我不能在CI中打开一个新的外壳,我怎么才能有同样的效果,让我可以使用conda-activate?

conda init命令用于向shell资源文件添加代码,为交互式shell会话提供功能(如conda activate(。由于CI会话通常是瞬态的,因此应该直接获取etc/profile.d/conda.sh以添加对conda activate的支持。

类似于:

conda env create -f python/env/foo.yml 
&& . "$(conda info --base)/etc/profile.d/conda.sh" 
&& conda activate foo

最新更新