我想知道如何在Google Colab的ipython(jupyter notbook)上运行bash出售脚本文件. 我从github下载了一个深度学习代码包,并将其上传到我的google驱动器上,然后将goole驱动器安装到了Google Colab上 该代码包包括"* .py" python代码和"fn.sh"脚本文件. 通过执行脚本文件,可以执行python代码.
I'd like to know how to run a bash sell script file on ipython(jupyter notbook) at Google Colab. I downloded an Deep-learning codes package from github and upload them on my google drive and I mount the goole drive on Google Colab The code package includes'*.py' python codes and 'fn.sh' script file. By executing the script file the python codes can be executed.
我在Google Colab的ipython提示符下尝试了os.system('fn.sh')和subprocess.call('fn.sh'),但它们无法像下面那样工作.
I tried os.system('fn.sh') and subprocess.call('fn.sh') on the ipython prompt at Google Colab but they doesn't work like below.
1)
import os os.system('drive/DL/denet-master/examples/simple-cifar10.sh') 322562)
import subprocess subprocess.call('drive/DL/denet-master/examples/simple-cifar10.sh') OSError: [Errno 8] Exec format error: 'drive/DL/denet-master/examples/simple-cifar10.sh'推荐答案
在Colab中,您可以使用!或%%shell调用Shell命令.
In Colab, you can invoke shell commands using either ! or %%shell.
您上面的调用将是:
!drive/DL/denet-master/examples/simple-cifar10.sh
这是一个笔记本示例:
colab.research.google/drive/1N7p0B-7QWEQ9TIWRgYLueW03uJgJLmka
更多推荐
如何在Google Colab的ipython上运行shell脚本文件
发布评论