1. jupyter-notebook安裝
Project Jupyter | Installing Jupyter

install
創(chuàng)建一個新的環(huán)境用于jupyter notebook運行:
conda create -n jupyter python按照官方教程安裝jupyter即可。
2. jupyter notebook配置
對jupyter進行一定的配置可以方便我們使用,尤其是遠程訪問服務(wù)器。
主要參考博客:【隨記】服務(wù)器安裝并配置jupyter notebook,并使用vscode擴展進行連接 - 氫離子活度指數(shù) - 博客園
2.1 在python中設(shè)定passwd
from jupyter_server.auth import passwd
passwd()
#然后會讓你輸出密碼,確認(rèn)密碼,以及返回密鑰數(shù)據(jù),備份返回的密鑰信息。
2.2 創(chuàng)建jupyter配置文件
運行jupyter notebook --generate-config生成jupyter環(huán)境配置文件(默認(rèn)在~/.jupyter/jupyter_notebook_config.py,同目錄下json文件是密鑰hash)
2.3 修改jupyter環(huán)境配置文件中以下配置項
c.ServerApp.ip='0.0.0.0'
c.ServerApp.password=u'sha1****' #就之前保存的驗證密碼
c.ServerApp.open_browser =False # 設(shè)置是否自動打開瀏覽器
c.ServerApp.port =8889 # 設(shè)置端口
c.ServerApp.allow_remote_access = True
c.ServerApp.root_dir = 'xxxxxxx' # 配置默認(rèn)訪問的目錄
2.4 啟動jupyter服務(wù)
即用即啟,占用一個shell,用后關(guān)閉:jupyter notebook --allow-root
2.5 vscode中使用(暫時還沒有配置)
待續(xù)
3. tmux中運行jupyter notebook
conda install -c conda-forge tmux
tmux new -s jp
jupyter notebook --allow-root
#http://Phenix:8889/tree
復(fù)制url到瀏覽器即可。如果按照步驟2準(zhǔn)確配置了jupyter,那么無需輸入密碼即可進入。