Jupyter Notebook安装及使用
什么是Jupyter notebook?
jupyter Notebook(此前被称为 IPython notebook)是一个交互式笔记本,支持运行 40 多种编程语言。 Jupyter Notebook 的本质是一个 Web 应用程序,便于创建和共享文学化程序文档,支持实时代码,数学方程,可视化和 markdown。 用途包括:数据清理和转换,数值模拟,统计建模,机器学习等等。
安装
使用下面的命令安装 jupyter:
pip install jupyter
可以使用下面的命令进行 jupyter 的版本更新:
pip install --upgrade jupyter
配置Jupyter notebook目录路径
安装完成后先不要启动,需要先配置目录路径,因为默认打开和保存的 Jupyter notebook 文件目录在C盘。
使用如下命令配置目录路径:
jupyter notebook --generate-config
此时,会生成一个默认配置文件 C:\Users\Administrator\.jupyter\jupyter_notebook_config.py
找到这个默认配置文件所在的目录,后续的很多配置文件都会生成到这个目录中
打开 jupyter_notebook_config.py
搜索 c.NotebookApp.notebook_dir
(大概在266行)
把 #
号去掉,把值改为你要存放Jupyter notebook文件的目录路径。以后Jupyter notebook创建的文件都会保存到这个目录路径中。
启动
使用如下命令启动 jupyter:
jupyter notebook
然后浏览器就会打开Jupyter notebook