我在持續集成中運行以下命令(不是在機器上本地):
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中打開新的shell,那我怎樣才能有同樣的效果,才能使用conda activate呢?
uj5u.com熱心網友回復:
該conda init命令用于向 shell 資源檔案添加代碼,conda activate為互動式 shell 會話提供功能(如 )。由于 CI 會話通常是短暫的,因此應該etc/profile.d/conda.sh直接獲取 CI 以添加conda activate支持。
就像是:
conda env create -f python/env/foo.yml \
&& . "$(conda info --base)/etc/profile.d/conda.sh" \
&& conda activate foo
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/410226.html
標籤:
上一篇:比較兩個檔案中缺少哪些行
下一篇:用逗號替換空格,括號內的文本除外
