关于jupyter notebook密码设置

对于一个jupyter编辑器使用的新手,更换浏览器或者Logout后,须要输入密码进行登录时python

按照网上的教程怎么设置都不行,那么本身整理了一个适用于初学者的操做。json

1.windows下,打开命令行,从新生成一个jupyter配置文件:windows

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 passwordspa

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登录,新密码均可以正常使用了。code

 

≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡orm

 

第3步也能够换成:ipython执行blog

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'
相关文章
相关标签/搜索