-
启动 conda 环境, 输入命令启动 jupyter
jupyter notebook在本地浏览器打开正常
-
远程访问需要修改配置文件
-
输入命令
jupyter notebook --generate-config执行成功后,出现以下信息
Writing default config to: /root/.jupyter/jupyter_notebook_config.py会在
/root/.jupyter/下面生成一个jupyter_notebook_config.py文件,用于jupyter的相关配置 -
生成密码
打开
ipython执行以下内容In [1]: from notebook.auth import passwd In [2]: passwd() Enter password: Verify password: Out[2]: 'sha1:**************************************************'sha1:**************************************************这一串就是要在jupyter_notebook_config.py添加的密码。 -
修改配置文件,添加密码
在
jupyter_notebook_config.py文件中找到下面这行,修改并取消注释。然后修改其他两行c.NotebookApp.password = u'sha:ce...刚才复制的秘钥' c.NotebookApp.ip = '*' c.NotebookApp.open_browser = False -
启动 jupyter, 浏览器输入密码就可以访问了。
-
-
jupyter 不能用 root 启动
修改
jupyter_notebook_config.py文件, 找到下面这行#c.NotebookApp.allow_root = False取消注释,改为 True 就可以了。
c.NotebookApp.allow_root = True -
其他配置
c.NotebookApp.ip = 'localhost' c.NotebookApp.open_browser = True(True:启动时自动打开浏览器,False:需手动打开浏览器访问http://localhost:8888/tree) c.NotebookApp.port = 8888(端口设置)