启动 conda 环境, 输入命令启动 jupyterhtml
jupyter notebook
复制代码
在本地浏览器打开正常python
远程访问须要修改配置文件linux
输入命令浏览器
jupyter notebook --generate-config
复制代码
执行成功后,出现如下信息加密
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
复制代码
会在/root/.jupyter/
下面生成一个 jupyter_notebook_config.py
文件,用于jupyter的相关配置url
生成密码spa
打开 ipython
执行如下内容.net
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:**************************************************'
复制代码
sha1:**************************************************
这一串就是要在 jupyter_notebook_config.py
添加的密码。code
修改配置文件,添加密码htm
在 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(端口设置)
复制代码