用Jupyter Notebook做笔记
ipython作为一个必备的学习/调试环境, notebook可以看做其增强版, 支持Markdown格式说明, 很适合用笔记或者演示/培训用途,基本是机器学习的标配.
安装及运行
推荐使用最新版JupyterLab
pip install jupyterlab
# 运行
jupyter lab
# 指定端口
jupyter lab --port=9999
注:在Windows 3.8下启动会报NotImplementedError错误,是因为tornado的实现问题。
解决方式:
# 编辑 C:\Users\<Your User Name>\AppData\Local\Programs\Python\Python38\Lib\site-packages\tornado\platform\asyncio.py
# 在 import asyncio下添加
# import asyncio
import sys
if sys.platform == 'win32':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
之前的安装方式:
python3 -m pip install jupyter notebook
jupyter notebook
# 新版的iPython要求Python 3.3以上,因此建议在python3环境使用
如果要在Python2.7运行,安装IPython5.7分支.
如果在本地没有运行环境,又想打开一个包含笔记的GitHub仓库, 可以使用binder在云端打开.
扩展
支持TOC目录
jupyter labextension install @jupyterlab/toc
多用户版本
扩展阅读
- 官网
- 用Jupyter做slides/ppt
- Python学习课程