/bin/bash:找不到命令 Google Colab

use*_*rld 3 google-colaboratory

我正在尝试在 Google Colab 上运行一个现成的项目。当我运行 shell 时,会出现以下错误:

/bin/bash: example.sh: command not found
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

Ami*_*mir 8

您有两种选择来运行 shell 脚本google-colab

1) 使用以下命令执行单个脚本!

!sh example.sh
!echo "I am your code !!!" 
Run Code Online (Sandbox Code Playgroud)

2) 将整个代码块作为 shell 脚本执行%%shell

%%shell
sh example.sh
echo "You should add %% "
Run Code Online (Sandbox Code Playgroud)

注意:在第二种方法中,整个块被解释为 shell 脚本。您不需要!在每个脚本的开头。