我有一个简单的jupyter笔记本,比如 foo.ipynb
. 我希望以通常的方式运行 nbconvert
:在我的本地机器上,我会在笔记本本身中执行 !jupyter nbconvert foo.ipynb
,或者在shell中执行 jupyter notebook foo.ipynb
. 在Google Colaboratory上,这不起作用 . 当然这是因为 foo.ipynb
没有在驱动器上本地运行,但是连接Drive和Colab的常用方法在这种情况下不起作用 . Question: is running nbconvert on a Colab notebook possible from within a Colab notebook (as in !jupyter nbconvert foo.ipynb), and if so, how? 我试过了:
-
(Colab文件菜单选项不进行必要的导出,这就是为什么我需要
nbconvert
. 下载到本地机器并运行nbconvert
也不是一个选项 . ) -
直接链接到文件的最简单尝试(经过身份验证时)
!jupyter nbconvert 'https://colab.research.google.com/drive/2pexUcovcblu1Api0F0NezyhZyN2MEMWLhs5ujm?authuser=2
-
这个SO帖子:Google Colab: how to read data from my google drive?但又没有运气,因为它似乎无法找到文件而且
nbconvert
只需要一个文件名 . -
SO帖子中建议的其他方法,包括:Is it possible to import my own modules into a google-colaboratory notebook?,Import data into Google Colaboratory,How to run a downloaded Jupyter notebook on Google Colaboratory?
如何在笔记本电脑内的colab笔记本上完成 nbconvert
?我可以在colab上验证 nbconvert
是否可用;它只是无法在上述任何方法下找到该文件(据我所知) .