美文网首页
配置jupyter服务

配置jupyter服务

作者: WILeroy | 来源:发表于2020-04-27 21:03 被阅读0次

1 生成配置文件

jupyter notebook --generate-config

以上命令会在用户目录下生成配置文件, 路径通常是: ~/.jupyter/jupyter_notebook_config.py, 该配置文件会在启动jupyter服务时生效.

2 修改配置文件

在生成的配置文件中加入配置项.

c.NotebookApp.ip = '*'              # 就是设置所有ip皆可访问  
c.NotebookApp.open_browser = False  # 禁止浏览器自动打开
c.NotebookApp.port = (port)         # jupyter使用端口

设置jupyter密码, 以下命令会引导密码设置, 并自动生成配置文件: ~/.jupyter/jupyter_notebook_config.json.

jupyter notebook password

3 配置kernel

jupyter服务不会自动包含anaconda创建的环境, 因此需要手动设置jupyter的kernel, 以便其找到已有的anaconda环境.

  • 查看已添加的kernel

jupyter kernelspec list

  • 添加kernel

(python) -m ipykernel install --name (kernel name)

  • 删除kernel

jupyter kernelspec remove (kernel name)

4 启动服务

  • 运行

jupyter notebook --allow-root

  • 后台运行

nohup jupyter notebook --allow-root &

相关文章

网友评论

      本文标题:配置jupyter服务

      本文链接:https://www.haomeiwen.com/subject/tqauwhtx.html