安装Jupyter Notebook的前提是安装了Python(3.3版本及以上,或2.7版本)。
Mac打开终端(terminal)并运行如下代码:
1.pip安装$ pip install jupyter2.brew安装
$ brew install jupyter
安装完成后,输入以下命令检查是否安装成功:
$ jupyter notebook
执行命令之后,在终端中将会显示一系列notebook的服务器信息,同时浏览器将会自动启动Jupyter Notebook。默认的 notebook 服务器的运行地址是 http://localhost:8888。其中,“localhost”指的是本机,“8888”则是端口号。
启动过程中终端显示内容如下:
$ jupyter notebook [I 08:58:24.417 NotebookApp] Serving notebooks from local directory: /Users/catherine [I 08:58:24.417 NotebookApp] 0 active kernels [I 08:58:24.417 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/ [I 08:58:24.417 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip /confirm/iation).
注意:之后在Jupyter
Notebook的所有操作,都请保持终端不要关闭,因为一旦关闭终端,就会断开与本地服务器的链接,你将无法在Jupyter
Notebook中进行其他操作。
如果你同时启动了多个Jupyter Notebook,由于默认端口“8888”被占用,因此地址栏中的数字将从“8888”起,每多启动一个Jupyter Notebook数字就加1,如“8889”、“8890”……
指定端口启动如果你想自定义端口号来启动Jupyter Notebook,可以在终端中输入以下命令:
# jupyter notebook --port启动服务器但不打开浏览器$ jupyter notebook --port 8990
如果你只是想启动Jupyter Notebook的服务器但不打算立刻进入到主页面,那么就无需立刻启动浏览器。在终端中输入:
$ jupyter notebook --no-browser
此时,将会在终端显示启动的服务器信息,并在服务器启动之后,显示出打开浏览器页面的链接。当你需要启动浏览器页面时,只需要复制链接,并粘贴在浏览器的地址栏中,轻按回车变转到了你的Jupyter Notebook页面。
参考资源[1] Install Jupyter Notebook on Mac – Step By Step Guide
[2] Jupyter Notebook介绍、安装及使用教程



