
上QQ阅读APP看书,第一时间看更新
1.2.4 Jupyter Notebook简介
Jupyter Notebook并不是IDE,正如它的名字,它是一个类似于“笔记本”的辅助工具。Jupyter Notebook是面向编程过程的,而且由于其独特的“笔记”功能,代码和注释在其中会显得非常整齐、直观。我们可以使用“pip install jupyter”命令来安装Jupyter Notebook。在PyCharm中也可以通过Python Interpreter来安装(见图1-16)。如果在安装过程中碰到了问题,则可以访问Jupyter Notebook官网获取更多信息。
在PyCharm中新建一个Jupyter Notebook文件(见图1-17)。

图1-16 在PyCharm中安装jupyter

图1-17 新建一个Jupyter Notebook文件
单击运行按钮后,会要求输入Token,这里可以不输入,直接单击“Run Jupyter Notebook”,按照提示进入Jupyter Notebook页面(见图1-18)。

图1-18 单击“Run Jupyter Notebook”后的提示
Jupyter Notebook文档被设计为由一系列单元(Cell)构成,主要有两种形式的单元:代码单元,用于编写代码,运行代码的结果显示在本单元下方;Markdown 单元,用于文本编辑,采用Markdown的语法规范,可以设置文本格式、插入链接、图片甚至数学公式(见图1-19)。

图1-19 Notebook的编辑页面
Jupyter Notebook 还支持插入数学公式、制作演示文稿、插入特殊关键字等。也正因为如此,Jupyter Notebook 在创建代码演示、执行数据分析等方面非常受欢迎,掌握这个工具将会使我们的学习和开发更为轻松、快捷。