首先安装好jupyter notebook
在命令行输入:jupyter notebook
问题
默认情况下,在浏览器用localhost:8888就可以访问jupyter notebook。但是,如果想要访问远程服务器上的notebook(如,访问172.20.20.21:8888)。这样改如何配置。
1. 生成一个jupyter notebook配置文件
~/.jupyter/jupyter_notebook_config.py
默认情况下,该文件是不存在的,需要我们自己创建。在命令行使用下面命令创建:
jupyter notebook --generate-config
2. 修改配置文件
打开配置文件 ~/.jupyter/jupyter_notebook_config.py
vim ~/.jupyter/jupyter_notebook_config.py
在~/.jupyter/jupyter_notebook_config.py中,修改下列行,并取消其注释。
c.NotebookApp.ip=‘172.20.20.21’ #使用自己的ip地址
c.NotebookApp.open_browser = False # 不自动打开浏览器
c.NotebookApp.port =8899 #可自行指定一个端口, 访问时使用该端口