如何在不编辑配置文件或传递硬路径的情况下从命令行启动 jupyter notebook 到当前目录中的 运行?

How do I start jupyter notebook from command-line to run in my current directory, without editing config files or passing hard paths?

Juypter notebook 目前有一个限制:Starting terminal in current directory

我如何从命令行(没有 Anaconda 或其他 GUI)执行此操作,没有以下不可接受的 hacky 方法? (特别是笔记本目录可能在调用之间或用户之间发生变化的地方?)

  1. 手动

  2. 在笔记本代码中嵌入硬路径。必须是绝对路径。 (讨厌)。也取决于用户。无法分发使用相对于其安装目录的路径正确处理文件的笔记本。或者跨机器。

迄今为止找到的最佳解决方案(在 Unix 上):

jupyter notebook --notebook-dir  `pwd` &

因为

jupyter notebook --notebook-dir  . &

(相对路径)不适用于笔记本内部的命令。

如果您使用的是 Windows,请在搜索框中键入 cmd 以转到命令提示符。 在 cmd 提示符下,将目录更改为要打开 Jupyter notebook 的路径。这可以通过输入

来完成

cd C:\your path here \

接下来输入更改后的路径并按回车键/

jupyter notebook

同样,您可以为 jupyter lab 输入 'jupyter lab'

大功告成。