本文共給出兩種密碼設置方法,一種為直接設置密碼法(較為便捷),另一種為hash密碼設置法
===================================
第一種:
直接設置密碼
注意:
ipython notebook 設置密碼后就不能使用 token 進入客戶端網頁了
1. 對應環境下 執行命令:
jupyter notebook password
密碼被寫入 .jupyter/jupyter_notebook_config.json 中:
2. 重新啟動 jupyter notebook
3. 使用密碼進入 jupyter notebook網頁客戶端:
=======================================
第二種方法:
設置hash密碼:
注意:
ipython notebook 設置hash密碼后就不能使用 token 進入客戶端網頁了
本文是在Ubuntu18.04環境下操作的。
1. 生成配置文件 jupyter_notebook_config.py
jupyter notebook --generate-config
2. 修改配置文件 jupyter_notebook_config.py
配置文件在 home下的 .jupyter文件夾下面
vim ~/.jupyter/jupyter_notebook_config.py
如何修改呢:
2.1 在對應的python環境下執行下面操作:
from notebook.auth import passwd p = passwd() print(p)
獲得設置的hash密碼(上面設置的是明文密碼,獲得的p為hash密碼,下面用獲得的hash密碼p 進行設置)
2.2 在 ~/.jupyter/jupyter_notebook_config.py 中找到 c.NotebookApp.password 字段將其修改為上一步獲得的hash密碼:
2.3 重啟 jupyter notebook
參考:
https://blog.csdn.net/smile_Shujie/article/details/88357371
===============================================================