jupyter安裝,修改登錄密碼,啟動


jupyter安裝,修改登錄密碼,啟動

1.安裝jupyter:

 

pip install jupyter 
 
 
(如果報錯)
pip install jupyter notebook 
 

2.生成jupyter的配置文件

  

jupyter notebook --generate-config  

3.修改jupyter的配置文件

vim ~/.jupyter/jupyter_notebook_config.py

將293行 #c.NotebookApp.token = '<generated>'修改為c.NotebookApp.token = 'password',則密碼就改為password

4。啟動jupyter

如果以root身份啟動需要加入--allow-root

jupyter notebook --ip=127.0.0.1 --port 8000 --allow-root

其他方式修改如下:

對於一個jupyter編輯器使用的新手,更換瀏覽器或者Logout后,需要輸入密碼進行登陸時

按照網上的教程怎么設置都不行,那么自己整理了一個適用於初學者的操作。

1.windows下,打開命令行,重新生成一個jupyter配置文件:

1
jupyter notebook  - - generate - config     

2.修個配置文件,找到這個新生成的文件:Windows: C:\Users\USERNAME\.jupyter\jupyter_notebook_config.py

 搜索 NotebookApp.allow_password_change,改為:NotebookApp.allow_password_change=False ,記得去掉注釋的#

3.回到windows命令行,運行jupyter notebook password

C:\Windows\System32>jupyter notebook password
Enter password:             #鍵入密碼,不顯示的
Verify password:            #再次重復鍵入密碼
[NotebookPasswordApp] Wrote hashed password to C:\Users\用戶\.jupyter\jupyter_notebook_config.json     #密碼生成的一串sha1,寫入到了這個文件,等下要把這串sha1,復制到第一個生成的配置文件中

4.還差一步密碼才可以生效使用,在第一個jupyter_notebook_config.py配置文件中找到“c.NotebookApp.password“,等於,剛生成的那個密碼sha1,效果如下:去掉前面的”#“

c.NotebookApp.password = u'sha1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

5.保險起見,把jupyter重啟,之后,無論是更換瀏覽器還是Logout登陸,新密碼都可以正常使用了。

 

≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

 

第3步也可以換成:ipython執行

復制代碼
C:\Windows\System32>ipython
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
復制代碼

 



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM