jupyter启动后,默认只有本机(只监听localhost)访问,但很多时候,我们想在浏览器上通过http://ip:端口的形式访问该应用。这里就写下方法:
通过配置文件实现
/* 生成配置文件 */
# jupyter notebook --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
/* 查看配置文件,发现如下内容 */
# c.NotebookApp.ip = 'localhost'
将上面的内容修改为:
c.NotebookApp.ip = '*'
再启动jupyter(jupyter notebook),就能通过浏览器访问jupyter了 。
启动命令中加参数
jupyter notebook --ip="*"
另外还需要注意的是:
- root用户启动时,需要使用
--allow-root
参数; jupyter-notebook
等价jupyter notebook,所以前者使用直接tab补全更方便些。