在雲伺服器(阿里雲,騰訊雲等通用)上安裝jupyter-notebook並遠端訪問
阿新 • • 發佈:2021-07-30
正常安裝jupyter notebook之後,執行如下命令
jupyter notebook --generate-config
生成配置檔案,在個人檔案目錄下的.jupyter資料夾下。
vim jupyter_notebook_config.py
設定可以進入jupyter notebook的ip地址,其中的‘*’代表所有的ip過來的請求都可以訪問
c.NotebookApp.ip = '*'
進入python介面,並引入包配置jupyter notebook訪問密碼
from notebook.auth import passwd passwd() Enter password: Verify password: Out[2]: 'sha1:8361f5f08937:081cdf40730cb5548e2c213ddd36813a5313192f'
將加密的金鑰寫在配置檔案中
c.NotebookApp.ip = '*' c.NotebookApp.password = 'sha1:8361f5f08937:081cdf40730cb5548e2c213ddd36813a5313192f'
設定不在服務端自動開啟瀏覽器(因為伺服器沒有)
c.NotebookApp.ip = '*' c.NotebookApp.password = 'sha1:8361f5f08937:081cdf40730cb5548e2c213ddd36813a5313192f' c.NotebookApp.open_browser = False
設定特定的埠可以訪問
c.NotebookApp.port = 8888
伺服器端後臺啟動jupyter notebook
nohup jupyter notebook --allow-root >> logs.out 2>&1 &