什么是Jupyter

Jupyter Notebook是一个开源的Web应用程序,可以创建和共享包含实时代码,方程式,可视化和说明文本的文档。

环境准备

Jupyter的安装需要ipython

  • 已经安装有ipython,则直接进行Jupiter的安装
  • 没有安装ipython,建议使用Anaconda3-4.2.0进行python环境的安装

说明:什么是Anaconda?
Anaconda中包含众多python的库,其中也包含Jupyter,所以如果使用的是Anaconda则使用

pip list

对其中的python库文件进行查找,如果有Jupyter则不需要再次安装。

安装

1.安装Anaconda

1、下载

jupyter spark安装 Apache Livy spark magic jupyter如何安装_配置文件


2、安装,一路next即可

jupyter spark安装 Apache Livy spark magic jupyter如何安装_python_02


3、安装成功的界面

2.安装Jupyter notebook

步骤
1、到目录【\Python37\Scripts】下
2、命令行输入:

pip install jupyter

3、安装,安装过程如下:

jupyter spark安装 Apache Livy spark magic jupyter如何安装_Python_03

4、安装成功,如下:

jupyter spark安装 Apache Livy spark magic jupyter如何安装_命令行_04


安装目录下会出现如下文件:

jupyter spark安装 Apache Livy spark magic jupyter如何安装_命令行_05

3.jupyter notebook的启动

步骤
1、安装目录下命令行输入:

jupyter notebook

2、默认浏览器会打开 Jupyter notebook 窗口。 说明 Jupyter notebook 安装成功了。

jupyter spark安装 Apache Livy spark magic jupyter如何安装_配置文件_06

说明:

默认打开的目录是:

jupyter spark安装 Apache Livy spark magic jupyter如何安装_配置文件_07

4.配置 Jupyter notebook

步骤
1、命令行输入命令:

jupyter notebook --generate-config

jupyter spark安装 Apache Livy spark magic jupyter如何安装_配置文件_08


2、打开“.jupyter”文件夹,可以看到里面有个配置文件。

jupyter spark安装 Apache Livy spark magic jupyter如何安装_python_09

3、修改jupyter_notebook_config.py配置文件

找到“c.NotebookApp.notebook_dir=……”,把路径改成自己的工作目录。

jupyter spark安装 Apache Livy spark magic jupyter如何安装_配置文件_10

4、配置完成后,重新启动即可
5、启动方式:
anaconda–>anaconda Prompt–>命令行输入:

jupyter notebook

6、启动后默认的打开路径就是之前配置好的路径啦。

使用

1、运行jupyter notebook

2、需要新建python文件的话,点击New–>Python3

jupyter spark安装 Apache Livy spark magic jupyter如何安装_Python_11


3、新建后,页面显示如下,菜单栏也出来了,就可以开始编写文件啦

jupyter spark安装 Apache Livy spark magic jupyter如何安装_Python_12

写在最后

安装过程中遇到的坑:

1、提示:‘jupter’ 不是内部或外部命令,也不是可运行的程序

解决
1、安装juputer,到目录【\Python37\Scripts】下,命令行输入:

pip install jupyter

2、重新启动即可