Python自学笔记三:jupyter notebook

本机环境:macOS11.6 + python3.7

使用pip安装

pip3 install  --user jupyter

如果你安装了Anaconda,那么就无需再次安装jupyter notebook,因为已经内置在里面。Anaconda是Python的数据科学发行版本,不仅自带Python软件,还内置了Jupyter、Pandas、Numpy、Matplotlib等几百种数据科学库。一次安装,应有尽有。当然全部安装的话还是比较大的,所以按需安装也不错。

安装完成后

#启动
jupyter notebook

Python自学笔记三:jupyter notebook_第1张图片

自动打开浏览器即可使用notebook

Python自学笔记三:jupyter notebook_第2张图片
点击新建 Python 3 (ipykernel)
Python自学笔记三:jupyter notebook_第3张图片

如果上面点击后弹出窗口提示没有Python 3 ipykernel,则需要做如下的配置

安装ipykernel

pip3 install ipykernel

查看jupyter的相关kernels列表

jupyter kernelspec list

在这里插入图片描述再看看其具体的配置文件

cat /usr/local/share/jupyter/kernels/python3/kernel.json

Python自学笔记三:jupyter notebook_第4张图片
编辑kernel.json文件,把python3的路径写对

vi /usr/local/share/jupyter/kernels/python3/kernel.json

Python自学笔记三:jupyter notebook_第5张图片
重启notebook即可

jupyter notebook

Python自学笔记三:jupyter notebook_第6张图片
测试打印hello notebooks

Python自学笔记三:jupyter notebook_第7张图片
测试三角函数

Python自学笔记三:jupyter notebook_第8张图片

jupyter Notebook的配置储存在jupyter_notebook_config.py文件中,但是通常这个文件需要自己创建

jupyter notebook --generate-config

在这里插入图片描述
Python绘图库:Matplotlib
Matplotlib教程

你可能感兴趣的:(Python,python,jupyter)