在更新Mac OS X 10.12.5后,发现当通过Anaconda打开JupyterNotebook时出现了以下错误,而且JupyterNotebook并没有通过浏览器启动

我们退出Anaconda,系统提示是否退出JupyterNotebook,这说明JupyterNotebook已经在8888端口上运行了

我们在浏览器地址栏输入(http://localhost:8888)就可以跳转到JupyterNotebook页面,但此时我们会发现页面要求我们输入密码

但这个密码之前并没有被设置过,尝试失败后页面会提示密码无效

我们点击(enable a password)可以进入帮助页面并得到以下解决方法

按说明创建一个系统配置文件文件,新建一个终端并输入以下内容:
jupyter notebook --generate-config
系统提示未找到jupyter指令,这是因为我们的JupyterNotebook是通过Anaconda来执行的:
-bash: jupyter: command not found
所以我们要预先配置好Anaconda的环境变量,在终端输入:
export PATH=~/anaconda/bin:$PATH
这时我们再次输入以下内容,创建一个jupyter的系统配置文件(直接安装的JupyterNotebook应该不会出现以上问题):
jupyter notebook --generate-config
系统提示以下内容,需要我们去选择是否在该目录下创建该配置文件:
Overwrite /Users/caiyutong/.jupyter/jupyter_notebook_config.py with default config? [y/N]
我们在终端键入“y”并回车确认创建该文件,系统提示以下内容:
Writing default config to: /Users/caiyutong/.jupyter/jupyter_notebook_config.py
系统配置文件创建成功后在终端输入以下内容并进行密码设置:
jupyter notebook password
输入两次密码后完成设置,终端显示以下内容:
Enter password:
Verify password:
[NotebookPasswordApp] Wrote hashed password to /Users/caiyutong/.jupyter/jupyter_notebook_config.json
完成设置后我们通过Anaconda进入JupyterNotbook,系统依然提示“不理解“open location”信息。 (-1708)”

但我们这事可以注意到,JupyterNotebook的运行端口变成了8889,我们复制该地址黏贴到浏览器地址栏
(http://localhost:8889/tree)注:请复制在终端上显示的地址,运行后端口可能不是8889

我们会发现系统要求我们输入密码,我们输入刚才在终端所设置的密码后,便可以进入JupyterNotebook

参考资料1:https://jupyter-notebook.readthedocs.io/en/stable/public_server.html
(关于JupyterNotebook密码设置)
参考资料2:https://www.168seo.cn/mac-os/23603.html
(关于JupyterNotebook报错及不能通过浏览器打开)
参考资料3:https://stackoverflow.com/questions/44057601/ipython-notebook-will-not-start-on-command-line
(关于JupyterNotebook不能通过命令行开启)
参考资料4:http://www.cnblogs.com/coolcold/p/6907787.html
(关于JupyterNotebook报错及不能通过浏览器打开) |