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

[Python] 配置远程登录 Jupyter

程序员文章站 2022-05-28 23:46:10
...
1. 生成配置文件
jupyter notebook --generate-config
2. 生成密码
$ python
>>> from notebook.auth import passwd
>>> passwd()

[Python] 配置远程登录 Jupyter

3. 将密码加入配置文件

打开配置文件

$ vim ~/.jupyter/jupyter_notebook_config.py 

在文件中写入

c.NotebookApp.ip='*'
c.NotebookApp.password = u'sha1:6a8e0254f260:acb58f62b06451e5cfb6ef6c779306ecc57687c6' 刚才生成的密码
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888
4. 运行并访问 Jupyter
$ jupyter notebook

如果启动时遇到下面的报错信息
[Python] 配置远程登录 Jupyter
表明 IP 设置有误, 此时执行

jupyter notebook --ip 0.0.0.0

即可正常启动 Jupyter, 然后在本地浏览器输入http://remote_ip:8888就可以看到 Jupyter 的登陆界面。