一、直接執行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 &