关于Jupyter Notebook的环境配置

目录

  • 1.jupyter notebook更换默认目录
  • 2.jupyter notebook配置虚拟Python环境

1.jupyter notebook更换默认目录

  第一步,在CMD下使用下面的命令创建配置文件。

jupyter notebook --generate-config

  执行结果:
创建jupyter notebook配置文件
  第二步,到指定目录用户下面的.jupyter配置文件夹,打开下面的文件。jupyter_notebook_config.py。

在这里插入图片描述
  第三步,修改默认打开路径,取消这一行的注释,然后在引号中加入你想要保存的路径,例如下图所示。
在这里插入图片描述
  第四步,将jupyter notebook快捷方式的"%USERPROFILE%/"这串字符删除后应用,重启jupyter notebook修改的路径生效了。
关于Jupyter Notebook的环境配置_第1张图片

2.jupyter notebook配置虚拟Python环境

  创建Python虚拟环境参考conda创建Python虚拟环境,激活虚拟环境test。

conda activate test

关于Jupyter Notebook的环境配置_第2张图片
  在test环境安装ipykernel,输入以下命令。

conda install -n test ipykernel

关于Jupyter Notebook的环境配置_第3张图片
  输入y,确认安装。
关于Jupyter Notebook的环境配置_第4张图片
  将虚拟环境写入Jupyter notebook配置文件,打开jupyter即能看到。

python -m ipykernel install --user --name test --display-name "test"

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