
十里(5km)工具
macOS升级到12.5后jupyter不能自动打开浏览器
升级 macOS 之后 jupyter notebook 不能自动打开浏览器了,终端还报了 bad interpreter 和 open location 的错。这篇记录了我在 ~/.jupyter 里新建 jupyter_notebook_config.py 修好它的做法。
0次点击0分钟阅读
升级了macOS后一直也没有使用 jupyter notebook,昨天使用了发现竟然不能自动打开浏览器了。
终端下调用 jupyter notebook:
1 2 3 4 5 6 7 8 9 10 11 12➜ LearnPythonNotebook git:(master) ✗ jupyter notebook zsh: /usr/local/bin/jupyter: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory [I 13:58:51.602 NotebookApp] Serving notebooks from local directory: /Users/smslit/Desktop/LearnPythonNotebook [I 13:58:51.602 NotebookApp] 0 active kernels [I 13:58:51.602 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=f6ca93231d4791de0dd64749e7f2fd62a50e55fc01456716 [I 13:58:51.602 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 13:58:51.606 NotebookApp] Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://localhost:8888/?token=f6ca93231d4791de0dd64749e7f2fd62a50e55fc01456716 0:97: execution error: “"http://localhost:8888/tree?token=50b06d86ad89e16f44b101656e1b3aec168231dd00b143a4"”不理解“open location”信息。 (-1708)
问了一下我们的哥(谷歌),找到了解决方案,在~/.jupyter 目录下创建文件 jupyter_notebook_config.py,文件内容如下:
1 2 3c.NotebookApp.browser = u'Safari' c.NotebookApp.token = '' c.NotebookApp.password = ''
重新启动一下 jupyter notebook:
1 2 3 4 5 6 7 8➜ LearnPythonNotebook git:(master) ✗ jupyter notebook zsh: /usr/local/bin/jupyter: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory [W 14:19:57.878 NotebookApp] All authentication is disabled. Anyone who can connect to this server will be able to run code. [I 14:19:57.888 NotebookApp] Serving notebooks from local directory: /Users/smslit/Desktop/LearnPythonNotebook [I 14:19:57.888 NotebookApp] 0 active kernels [I 14:19:57.888 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/ [I 14:19:57.888 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
可以自动打开safari了,peace!



