一、问题描述
安装Anaconda后打开Jupyter Notebook,默认的工作目录一般为C:\Users\Administrator,如下图所示:
![](https://img.haomeiwen.com/i6262017/59750fcf5334cfa2.png)
二、更改Jupyter Notebook 默认的工作目录的操作步骤
1、生成配置文件jupyter_notebook_config.py
打开Anaconda Prompt,执行命令jupyter notebook --generate-config。
![](https://img.haomeiwen.com/i6262017/b38cbd1f8ac70dce.png)
![](https://img.haomeiwen.com/i6262017/c157b32c34dec587.png)
2、修改配置文件jupyter_notebook_config.py
打开jupyter_notebook_config.py,修改c.ServerApp.notebook_dir配置并保存。
![](https://img.haomeiwen.com/i6262017/238a92e578a2436c.png)
注意文件路径分隔符使用‘\\’。
3、修改Jupyte Notebook快捷方式的属性
鼠标右击“Jupyte Notebook”, 选择“属性”,将“目标”中的系统变量"%USERPROFILE%/"删除
![](https://img.haomeiwen.com/i6262017/29600b2026fcf681.png)
4、重新打开Jupyte Notebook,默认的工作目录更改生效。
![](https://img.haomeiwen.com/i6262017/ff32c30217e204a1.png)
![](https://img.haomeiwen.com/i6262017/88363babe66ebf30.png)
网友评论