启动jupyter-lab并从命令行打开特定的笔记本吗? [英] Launch jupyter-lab and open a specific notebook from the command line?
问题描述
我正在编写一个bash脚本,最后以启动jupyter-lab并(理想情况下)打开特定笔记本为例.
I'm writing a bash script that ends by launching jupyter-lab and (ideally) opening a specific notebook.
在jupyter中,这很容易做到:
In jupyter, this is easy to do:
$ jupyter笔记本my_folder/my_notebook.ipynb
在jupyter-lab中找不到有关如何执行此操作的指导.想法?
I can't find any guidance for how to do this in jupyter-lab. Ideas?
推荐答案
似乎没有详细记录,但是至少有两种方法可以打开特定文件:
This seems not to be documented in great detail but there are at least two ways of opening specific files:
只需使用 jupyter lab
命令(请参见此评论)
Simply using the jupyter lab
command (see this comment)
$ jupyter lab my_folder/my_notebook.ipynb
或使用 Jupyter URLs .首先,在没有浏览器的情况下启动jupyter实验室服务器,然后打开一个URL,以查找所选文件:
or using the Jupyter URLs. First, you start the jupyter lab server, without browser and then open an URL locating the file of choice:
$ jupyter lab --no-browser &
$ sensible-browser http(s)://<server:port>/<lab-location>/lab/tree/path/to/notebook.ipynb
可以用您选择的浏览器(例如 google-chrome
或 firefox
)替换明智的浏览器
,并且可以使用特定的URL部分可以从第一个命令显示的URL中检索(可能可以自动提取并组合该URL).
where sensible-browser
can be replaced by the browser of your choice (e.g. google-chrome
or firefox
) and specific URL parts can be retrieved from the URL displayed by the first command (possibly one could extract and assemble the URL automatically).
Jupyter URL似乎更具可定制性(提供了工作区的选择,等等).
The Jupyter URLs seem to be a bit more customizable (offering the choice of workspace, etc).
这篇关于启动jupyter-lab并从命令行打开特定的笔记本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!