其他分享
首页 > 其他分享> > 如何禁用Jupyter笔记本会话的密码请求?

如何禁用Jupyter笔记本会话的密码请求?

作者:互联网

我使用以下命令多年来一直在推出Jupyter Notebook:

jupyter-notebook --port=7000 --no-browser --no-mathjax

当我尝试在浏览器上打开jupyter时,它会向我询问密码,即使我以前从未设置过任何密码.
重要的是要注意,如果我将端口设置为不同于7000的值(例如,默认的8888),接口将打开没有问题

我在本地运行jupyter,并在以下设置:

Python 3.5.2

安装以下模块:

jupyter (1.0.0), jupyter-client (4.4.0), jupyter-console (5.0.0), jupyter-core (4.2.1), ipykernel (4.5.2), ipython (5.1.0), ipython-genutils (0.1.0), nbconvert (4.3.0), nbformat (4.2.0), notebook (4.3.0)

注意:我没有jupyter配置文件

以下是服务器的一些输出行:

[I 19:16:24.358 NotebookApp] Serving notebooks from local directory: /Users/my_user_name
[I 19:16:24.358 NotebookApp] 0 active kernels
[I 19:16:24.358 NotebookApp] The Jupyter Notebook is running at: http://localhost:7000/?token=aa0dab6e2d85766f3e2e4f0f6633e4473db56a56c94cac76
[I 19:16:24.358 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

我尝试在浏览器上打开它后使用以下消息(使用端口7000)

[I 19:21:56.848 NotebookApp] 302 GET /tree (::1) 8.46ms
[D 19:21:56.857 NotebookApp] Using contents: services/contents
[D 19:21:56.919 NotebookApp] Path base/images/favicon.ico served from /usr/local/lib/python3.5/site-packages/notebook/static/base/images/favicon.ico
[D 19:21:56.920 NotebookApp] Path components/jquery-ui/themes/smoothness/jquery-ui.min.css served from /usr/local/lib/python3.5/site-packages/notebook/static/components/jquery-ui/themes/smoothness/jquery-ui.min.css
[D 19:21:56.922 NotebookApp] Path components/jquery-typeahead/dist/jquery.typeahead.min.css served from /usr/local/lib/python3.5/site-packages/notebook/static/components/jquery-typeahead/dist/jquery.typeahead.min.css
[D 19:21:56.923 NotebookApp] Path style/style.min.css served from /usr/local/lib/python3.5/site-packages/notebook/static/style/style.min.css
[D 19:21:56.925 NotebookApp] Path auth/css/override.css served from /usr/local/lib/python3.5/site-packages/notebook/static/auth/css/override.css
[D 19:21:56.926 NotebookApp] Path components/es6-promise/promise.min.js served from /usr/local/lib/python3.5/site-packages/notebook/static/components/es6-promise/promise.min.js
[D 19:21:56.926 NotebookApp] Path components/requirejs/require.js served from /usr/local/lib/python3.5/site-packages/notebook/static/components/requirejs/require.js
[D 19:21:56.933 NotebookApp] Path base/images/logo.png served from /usr/local/lib/python3.5/site-packages/notebook/static/base/images/logo.png
[D 19:21:56.934 NotebookApp] 200 GET /login?next=%2Ftree (::1) 80.86ms
[D 19:21:57.001 NotebookApp] Path custom.css served from /usr/local/lib/python3.5/site-packages/notebook/static/custom/custom.css
[D 19:21:57.003 NotebookApp] 304 GET /custom/custom.css (::1) 3.11ms
[D 19:21:57.341 NotebookApp] Path auth/js/main.min.js served from /usr/local/lib/python3.5/site-packages/notebook/static/auth/js/main.min.js
[D 19:21:57.344 NotebookApp] 200 GET /static/auth/js/main.min.js?v=20161219191623 (::1) 3.57ms

此时有一个来自jupyter的页面,要求我插入一个我从未设置过的密码.

解决了!

随着笔记本电脑模块(4.3.1)的最新更新,问题已经解决.

启动jupyter笔记本后,系统会提示用户在第一次连接时将URL粘贴到浏览器中:

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
    http://localhost:7000/?token=32be0f5ee74cfe521187bc479855ce8b9fbab9e8021701c9

这解决了这个问题!

解决方法:

您可以使用以下命令完全删除密码:

jupyter notebook --ip='*' --NotebookApp.token='' --NotebookApp.password=''

没有–NotebookApp.password =”,当从远程计算机连接到本地Jupyter时,只需使用以下命令启动:

jupyter notebook --ip='*'

出于安全原因,它仍然要求输入密码,因为具有访问权限的用户可以在服务器计算机上运行任意Python代码!

在Jupyter 4.4.x上测试过.

标签:python-3-5,python,jupyter-notebook,ipython,jupyter
来源: https://codeday.me/bug/20190926/1821850.html