是否可以在引导时启动 Jupyter notebook?

Is it possible to start a Jupyter notebook on a boot?

我想在 Mac 的引导程序上打开一个 Jupyter notebook 页面。具体来说,我使用launchctl来启动Jupyter notebook。

但是重启后网页显示密码或token验证:

这是我在 High Sierra 上使用的 launchctl 脚本。我发现费心输入令牌很费力。那么是否可以在重启时忽略令牌验证,就像输入 jupyter notebook?

时一样
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
           http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>me.jupyter</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/local/bin/jupyter</string>
      <string>notebook</string>
      <string>--no-browser</string>
      <string>--port</string>
      <string>9090</string>
      <string>--notebook-dir</string>
      <string>/Users/me/jupyter/</string>
    </array>
    <key>KeepAlive</key>
    <true />
    <key>RunAtLoad</key>
    <true />
    <key>StandardErrorPath</key>
    <string>/Users/me/jupyter/jupyter-notebook.stderr</string>
    <key>StandardOutPath</key>
    <string>/Users/mejupyter/jupyter-notebook.stdout</string>
  </dict>
</plist>

这可能适合你:

If you do not care about the security of the server, you can first create a jupyer config file with: cd ~/.jupyter jupyter notebook --generate-config Then set the c.NotebookApp.token parameter to an empty string in the configuration file created c.NotebookApp.token = '' As said in comment, Setting to an empty string disables authentication altogether, which is NOT RECOMMENDED.

来源:https://github.com/jupyter/notebook/issues/2254

实际上在更高版本的 Jupyter 笔记本中,您必须显式 运行 带有参数 --NotebookApp.token= 的服务器。所以将其添加到plist文件中。

并且作为其他答案注释,在配置文件中写入以下内容:

c.NotebookApp.token = ''