我一般不太关注App Store的升级提示,但是看见了就升级。这倒不是为了赶时髦,而是我知道不升级的话,系统漏洞可能会被攻击。
之前的macOS升级还都比较顺利。软件兼容性也都没啥问题。
今天不一样了。
升级到了10.12.5后,像往常一样执行:
<span class="wp_keywordlink_affiliate"><a href="https://www.168seo.cn/tag/jupyter-notebook" title="View all posts in jupyter notebook" target="_blank">jupyter notebook</a></span>
1
2
|
jupyter
notebook
|
结果突然报错,吓了我一跳:
➜ LearnPythonNotebook git:(master) ✗ <span class="wp_keywordlink_affiliate"><a href="https://www.168seo.cn/tag/jupyter-notebook" title="View all posts in jupyter notebook" target="_blank">jupyter notebook</a></span> zsh: /usr/local/bin/jupyter: bad interpreter: /usr/local/opt/<span class="wp_keywordlink"><a href="http://www.168seo.cn/python" title="python">python</a></span>/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)0:97: <span class="hljs-keyword">execution</span> <span class="hljs-keyword">error</span>: “<span class="hljs-string">"http://localhost:8889/tree?token=760a6d28d716f1671f0cf72f82a3cd5db958743fa86112f4"</span>”不理解“open location”信息。 (-1708)
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
)
0
:
97
:
<
span
class
=
"hljs-keyword"
>
execution
<
/
span
>
<
span
class
=
"hljs-keyword"
>
error
<
/
span
>
:
“
<
span
class
=
"hljs-string"
>
"http://localhost:8889/tree?token=760a6d28d716f1671f0cf72f82a3cd5db958743fa86112f4"
<
/
span
>”不理解“
open
location”信息。
(
-
1708
)
|
对我来说,Jupyter Notebook属于学习工作必需品。大意不得。
好在看了看信息,似乎服务已经在端口8888上面运行了。
只是平时执行上述命令,Chrome就能自动弹出来,开启笔记本列表。现在好像这一步出问题了。没关系,我就手动执行吧。在浏览器里面输入:
[localhost:8888](http://localhost:8888)
1
2
|
[
localhost
:
8888
]
(
http
:
/
/
localhost
:
8888
)
|
结果,笔记却没能直接出来。
让我输入密码。我设过密码吗?尝试了各种组合,均告失败。
于是我上网查询资料。还好,综合各方观点,找到了解决办法。
我遭遇的是两个问题:
- jupyter近期更新了安全机制,默认需要输入密码才能使用;
- 浏览器无法自行开启,确实是因为macOS 10.12.5环境的问题。
解决方法很简单。
在Jupyter的配置目录
~/.jupyter
1
2
|
~
/
.
jupyter
|
下面新建一个文件,名称是:
jupyter_notebook_config.py
1
2
|
jupyter_notebook_config
.
py
|
在这个文件里面加入3行代码:
c.NotebookApp.browser = u'Safari' c.NotebookApp.token = '' c.NotebookApp.password = ''
1
2
3
4
|
c
.
NotebookApp
.
browser
=
u
'Safari'
c
.
NotebookApp
.
token
=
''
c
.
NotebookApp
.
password
=
''
|
保存文件,重新执行:
jupyter notebook
1
2
|
jupyter
notebook
|
效果是这样的:
各路豪杰尝试过多种方法,可是目前只有Safari浏览器可以通过这种方式调用。Google Chrome可能还得等几天,看看根据macOS的新版本,Jupyter能否做出一些升级调整。