anaconda:无法使用 shell 脚本切换环境

问题描述

我安装了anaconda。我用的是centOS 8.2,anaconda安装包名称是:Anaconda3-2020.11-Linux-x86_64.sh

随着初始化,环境是基础。如以下命令行所示:

(base) [sjj@localhost ~]$

我写了一个名为env.sh的shell脚本如下,目的是为了切换环境:

#!/bin/sh

conda activate ray-tutorial
 

它总是说:

(base) [sjj@localhost ~]$ sh env.sh

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脚本在这种情况下不起作用?

(base) [sjj@localhost ~]$ conda activate ray-tutorial
(ray-tutorial) [sjj@localhost ~]$
 

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)