天天看點

網絡通路jupyter notebook密碼設定

啟動notebook并設定伺服器ip:

jupyter notebook --NotebookApp.ip='192.168.31.78'

浏覽器通路notebook ip:http://192.168.31.78:8888/tree    

網絡通路jupyter notebook密碼設定

需要密碼,解決辦法:

1.再生jupyter配置檔案:  

C:\Users\38016>jupyter notebook --generate-config

Overwrite C:\Users\38016\.jupyter\jupyter_notebook_config.py with default config? [y/N]y

Writing default config to: C:\Users\38016\.jupyter\jupyter_notebook_config.py

有資料說要在Anaconda Prompt視窗中運作指令才可以,我在cmd視窗裡運作,兩者比較下結果,也沒發現什麼不同。

2.修改配置檔案

編輯C:\Users\38016\.jupyter\jupyter_notebook_config.py          第68行

搜尋 NotebookApp.allow_password_change,改為 NotebookApp.allow_password_change=False 

網絡通路jupyter notebook密碼設定

3.設定密碼:

C:\Windows\System32>jupyter notebook password

Enter password: #設新密碼,盲打

Verify password: #再錄一遍

網絡通路jupyter notebook密碼設定

編輯寫入密碼的檔案%USERPROFILE%\.jupyter\jupyter_notebook_config.json,複制其中的密碼備用.

網絡通路jupyter notebook密碼設定

4.将密碼複制到配置檔案

C:\Users\38016\.jupyter\jupyter_notebook_config.py中,  283行

網絡通路jupyter notebook密碼設定

找到檔案中“c.NotebookApp.password“,值修改剛為第3步中生成的那個密碼sha1,效果如上圖:

5.jupyter重新開機,web通路有效

之後,無論是更換浏覽器還是Logout登陸,新密碼都可以正常使用了。

參考:

取消jupyter notebook的密碼參考https://blog.csdn.net/u014410989/article/details/90172737,但實際操作不行.

修改%userprofile%\.jupyter\jupyter_notebook_config.py:

#c.NotebookApp.token = '<generated>'成為c.NotebookApp.token = ''    第348行,把=後面單引号中的内容删掉成空

網絡通路jupyter notebook密碼設定

如此操作之後,但依然需要密碼。之前,曾用jupyter notebook password生成過密碼,在%userprofile%\.jupyter\jupyter_notebook_config.json中,修改其中的密碼項,加//注釋不行,重複關鍵字也不行,删掉密碼那一行也不行,啟動時閃退,看不到運作視窗,也不出浏覽器。

解決辦法:此時,修改.json檔案名,使其失效,或者直接删去這個寫有密碼的檔案也行。結果用IP位址登入也都不需要密碼了。

OK!

關于jupyter notebook密碼設定https://blog.csdn.net/weixin_43976343/article/details/85018894

原文檔https://jupyter-notebook.readthedocs.io/en/stable/public_server.html