- 积分
- 849
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-3-15
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 channam 于 2022-6-30 09:44 编辑
江湖救急呀
因为在linux上安装的ncl为anaconda版本的,我在linux里每次运行ncl,需要输入命令conda activate ncl_stable ,激活ncl环境。
运行完ncl脚本,再conda deactivate,退出ncl环境。
现在想在shell脚本里运行ncl脚本
但是在shell脚本里写 conda activate ncl_stable 和 conda deactivate,会报错,请问有没有解决的办法呀???
脚本:
#!/bin/bash
conda activate ncl_stable
......
ncl hynout_txt.ncl
conda deactivate
报错:
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'.
autochem_out.sh: line 101: ncl: command not found
CommandNotFoundError: Your shell has not been properly configured to use 'conda deactivate'.
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脚本里最上面添加 source ~/.bashrc 即可。
#!/bin/bashsource ~/.bashrc
conda activate ncl_stable
......
ncl hynout_txt.ncl
conda deactivate
|
|