欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Jupyter notebook服务器配置

程序员文章站 2022-03-03 15:06:36
...

配置密码

手动配置密码

jupyter notebook --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
# ~/.jupyter
[[email protected] ~]# python3
Python 3.6.8 (default, Aug  7 2019, 17:28:10)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from notebook.auth import passwd
>>> passwd()
Enter password:
Verify password:
'sha1:b483be92e652:3c7a41f7917bc5a6d551d9114cdb88ffc0f9c00e'
>>>

自动配置密码

jupyter notebook password

配置jupyter_notebook_config.py

# 允许所有ip访问
c.NotebookApp.ip="*"
# 密码:之前生成的那一串
c.NotebookApp.password = 'sha1:b483be92e652:3c7a41f7917bc5a6d551d9114cdb88ffc0f9c00e'

# 是否打开浏览器
c.NotebookApp.open_browser = False

# 指定端口默认8888
c.NotebookApp.port = 80

# 启动MathJax
c.NotebookApp.enable_mathjax = True

# 修改工作空间文件夹
c.NotebookApp.notebook_dir = '/root/jupyter/'

启动

jupyter notebook --allow-root
# 后台运行
nohup jupyter notebook --allow-root &
# 可能需要解决端口问题,我阿里云是添加安全策略里面添加入站规则