如何从命令行启动 jupyter notebook 以在当前目录中运行,而无需编辑配置文件或传递硬路径?

smc*_*mci 4 relative-path command-line-interface invocation jupyter jupyter-notebook

Juypter notebook 目前有一个限制:在当前目录中启动终端

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

  1. 参数中手动编辑硬路径到您的 jupyter notebook 配置文件中c.NotebookApp.notebook_dir

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

smc*_*mci 5

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

jupyter notebook --notebook-dir  `pwd` &
Run Code Online (Sandbox Code Playgroud)

因为

jupyter notebook --notebook-dir  . &
Run Code Online (Sandbox Code Playgroud)

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