- 安装jupyter
#使用conda安装
$ conda install jupyter
- 生成配置文件
Jupyter Notebook 默认的配置只能从本地访问,所以需要生成配置文件,然后修改
$jupyter notebook --generate-config
Writing default config to: /home/.jupyter/jupyter_notebook_config.py
- 生成访问密码
#使用 ipython 生成远程访问 jupyter notebook 的加密密码
$ipython
Python 3.6.3 |Anaconda, Inc.| (default, Oct 13 2017, 12:02:49)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:7caacee5027e:24b5981ae648adeff5644490a618f8cf6db1e12f'
- 配置
$ vi /home/.jupyter/jupyter_notebook_config.py
找到以下行,并修改
# 默认为 localhost,修改为 * ,允许所有IP访问
c.NotebookApp.ip='*'
# 上一步生成的加密密码
c.NotebookApp.password = 'sha1:7caacee5027e:24b5981ae648adeff5644490a618f8cf6db1e12f'
# 启动时不启动浏览器
c.NotebookApp.open_browser = False
- 启动
$jupyter notebook
- 本地windows浏览器访问
#浏览器输入IP:8888
参考 https://zhuanlan.zhihu.com/p/38913360