Article Directory
Preface
This blog post records some basic configurations of Jupyter Notebook (Anaconda) in Windows 10 and some commonly used commands.
1. Add kernel
# 查看Jupyter Notebook里的所有kernel
jupyter kernelspec list
# 切换到要添加的虚拟环境,检查是否安装了ipykernel
python -m ipykernel --version
# 在相应的虚拟环境里安装ipykernel
python -m pip install ipykernel
# 添加内核
python -m ipykernel install --user --name 要添加的环境名 --display-name jupyter中显示的kernel名
# 删除内核
jupyter kernelspec remove kernel名
2. Change the file storage location
# 先生成配置文件,根据打印的信息找到配置文件
jupyter notebook --generate-config
# 更改jupyter_notebook_config.py文件里的信息如下
c.NotebookApp.notebook_dir = '要存放jupyter notebook文件的路径'
# 然后修改Jupyter Notebook的快捷方式
删除"%USERPROFILE%/"
Then start Jupyter Notebook again, you can have a fresh interface:
3. Basic operation
hot key | Features |
---|---|
Shift + Enter |
Run a code block |
Tab |
Code completion |
Shift + 双击 |
View the parameters required by the function |
%matplotlib inline |
Display the drawn picture directly on this page |
%pwd |
Get the path of the current code file |
%timeit + 代码 |
Calculate the time required to execute this code |