网络访问jupyter notebook密码设置

    科技2022-07-11  109

    启动notebook并设置服务器ip:

    jupyter notebook --NotebookApp.ip='192.168.31.78'

    浏览器访问notebook ip:http://192.168.31.78:8888/tree      

    需要密码,解决办法:

    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 

    3.设置密码:

    C:\Windows\System32>jupyter notebook password Enter password: #设新密码,盲打 Verify password: #再录一遍

    编辑写入密码的文件%USERPROFILE%\.jupyter\jupyter_notebook_config.json,复制其中的密码备用.

    4.将密码复制到配置文件

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

    找到文件中“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 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

    Processed: 0.009, SQL: 8