一、直接执行html
pip3 install jupyter
二、没法执行jupyter notebook后报错node
“jupyter:command not found”
三、找到安装的位置,通常都在python3的目录下python
cd /usr/local/python3/bin
四、将下面的命令添加到 ~/.bash_profile 中浏览器
export PATH=/usr/local/python3/bin:$PATH
五、执行的时报错bash
OSError: [Errno 99] Cannot assign requested address
六、寻找解决方案测试
http://www.javashuo.com/article/p-zdblyosl-de.htmlspa
使用jupyter notebook --ip=0.0.0.0 --no-browser --allow-root启动code
七、进入python3建立密码orm
[root@Dao ~]#ipython Python 3.6.5 (default, Apr 16 2019, 14:58:48) Type 'copyright', 'credits' or 'license' for more information IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: from notebook.auth import passwd In [2]: passwd() Enter password: Verify password: # 而后就会生成秘钥,记得复制下来,配置密码的时候要用到
Out[2]: 'sha1:40ad5fc36b7a:8ff22a722b50b87a75d9e39017039594ade1fe47'
七、建立jupyter配置文件htm
jupyter notebook --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
八、编辑配置文件
c.NotebookApp.ip='*' # 就是设置全部ip皆可访问 c.NotebookApp.password = u'sha:ce...' # 刚才复制的那个密文' c.NotebookApp.open_browser = False # 禁止自动打开浏览器 c.NotebookApp.port =8888 #随便指定一个端口 c.NotebookApp.notebook_dir = u'' # 指定工做目录
九、生成测试认证
#此命令会在你的当前文件夹生成mycert.pem文件 openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.pem -out mycert.pem #编辑jupyter_notebook_config.py 配置文件,添加以下配置 c.NotebookApp.certfile = u'路径名/mycert.pem'
jupyter notebook --ip=0.0.0.0 --allow-root
浏览器访问https://ip:8888,注意必定要用https协议,http是访问不了的
十一、正式证书的配置
#添加以下配置 c.NotebookApp.certfile = u'/*.crt' #crt文件路径 c.NotebookApp.keyfile = u'/*.key' #key文件路径
十二、后台运行
nohup jupyter notebook --ip=0.0.0.0 --no-browser --allow-root >> /root/notebook.log &