本地访问服务器jupyter notebook
1 默认服务器上jupyter notebook安装完成(建议使用Anaconda,自带jupyter)
2 配置环境,通过远程方式访问jupyter notebook
$ jupyter notebook --generate-config --allow-root
3 生成登录密码
$ python
Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 17:14:51)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from notebook.auth import passwd
>>> passwd()
Enter password:
Verify password:
'sha1:e014e86fa5e2:5f486fca6f143dc92cc7fd8f06d5714205be5523'
>>> exit()
4 修改配置文件
vim ~/.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip='*'
c.NotebookApp.password = u'sha1:e014e86fa5e2:5f486fca6f143dc92cc7fd8f06d5714205be5523'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888
5 服务器打开jupyter notebook
jupyter notebook --ip=0.0.0.0 --no-browser --allow-root
6 本地访问 http://服务器IP:8888
7 有可能之后输入密码时会有冲突:jupyter_notebook_config.json has higher priority
解决办法:
强行重置了jupyter notebook的密码 。
输入命令:jupyter notebook password
然后设置你的密码即可。