远程登录jupyter notebook

1、python中创建密码

In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password: 
Verify password: 
Out[2]: 'sha1:ce23d945972f:34769685a7ccd3d08c84a18c63968a41f1140274'

2、生成配置文件

jupyter notebook --generate-config

3、修改配置文件vim ~/.jupyter/jupyter_notebook_config.py

c.NotebookApp.ip='*' # 就是设置所有ip皆可访问
c.NotebookApp.password = u'sha:ce...刚才复制的那个密文'
c.NotebookApp.open_browser = False # 禁止自动打开浏览器
c.NotebookApp.port =8888 #随便指定一个端口

4、启动jupyter notebook,远程登录

jupyter notebook

浏览器输入http://address_of_remote:8888,输入密码登录

 

突然有一天居然报错

报错:
KeyError: ‘allow_remote_access’
ValueError: ‘’ does not appear to be an IPv4 or IPv6 address
socket.gaierror: [Errno -3] Temporary failure in name resolution

解决办法如下,添加这一行:

c.NotebookApp.allow_remote_access = True

 

posted on 2018-01-07 16:34  medsci  阅读(232)  评论(0编辑  收藏  举报