一、jupyter notebook配置多环境
首先WIN+R打开cmd窗口,创建新的虚拟环境。
conda create -n envname python=3.6
# envname为你用conda创建的环境名称
# python=3.6指的是所使用的Python版本
conda activate envname
# 激活该环境
pip install ipykernel
# 在jupyter notebook需要切换内核,需要安装上这个包
python -m ipykernel install --name kernelname
# 给该环境的内核命名为 kernelname,则jupyter notebook会多出一个内核 kernelname
jupyter notebook
# 就可以在jupyter notebook中切换内核
# 删除指定kernel:
jupyter kernelspec remove icsharpkernel
二、修改Jupyter Notebook默认工作路径
1. 打开Windows的cmd,在cmd中输入
jupyter notebook --generate-config
2. 在用户目录(比如:C:\user\xx\.jupyter\)下找到
jupyter_notebook_config.py 文件
用记事本类软件打开(比如notebook++)
## The directory to use for notebooks and kernels.
#c.NotebookApp.notebook_dir = ''
将其改为
## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'C:\\workspace'
注意:文件分隔符使用 \\ 而不是 \