第一步 检查Python环境
python -V
第二步 通过pip安装jupyter
pip install jupyter
第三步 生成jupyter配置文件
#root客户:
jupyter notebook --generate-config --allow-root
#非root客户
jupyter notebook --generate-config
值得一提的是:windows环境下,并没有jupyter_notebook_config.py这个配置文件,怎么办呢?
可以打开Anaconda Promote界面,执行上面相同的命令即可生成。
第四步 打开ipython,生成密码
[root@xxj]# ipython
In [1]: from notebook.auth import passwd
In [2]: passwd()
会让输入两次密码,输入完成后 复制生成的 秘钥,后面会用到,秘钥带上sha1
jupyter忘记密码重置密码
jupyter notebook password # 按提示,输入密码 notebook
jupyter lab password # 按提示,输入密码 lab
第五步 修改配置文件,root用户默认在root目录
vim /root/.jupyter/jupyter_notebook_config.py
#改几个地方:
c.NotebookApp.ip = 'xx.xxx.xx.xxx' 即对外提供访问的ip,云服务外网ip
c.NotebookApp.port = 8888 即对外提供访问的端口
c.NotebookApp.open_browser = False False即启动不打开浏览器
c.NotebookApp.password = u'sha1:XXXXX' 这个就是上面生成的秘钥
c.NotebookApp.notebook_dir = u'/opt/jupyter_dir' 即设置jupyter启动后默认的根目录
第六步 启动jupyter
root用户,后台启动。非后台启动 去掉nohup
nohup jupyter notebook --allow-root&