jupyter notebook 默认工作目录
时间: 2024-11-01 16:04:10 浏览: 77
Jupyter Notebook的默认工作目录可以在安装后进行修改,以避免占用过多磁盘空间。以下是两个不同的方法:
1. **通过Anaconda Prompt(命令行)**[^1]:
- 打开Anaconda Prompt,然后运行以下命令来创建或编辑jupyter notebook的配置文件(`jupyter_notebook_config.py`):
```shell
conda activate your_environment_name # 如果你有虚拟环境,替换为你的环境名
jupyter notebook --generate-config
```
- 这将在`%USERPROFILE%\.jupyter`目录下生成`jupyter_notebook_config.py`文件。接着,你可以编辑此文件,找到`c.NotebookApp.notebook_dir`这一行,将其路径更改为新的工作目录。
2. **在Jupyter Notebook本身设置**:
- 启动Jupyter Notebook时,在命令行添加`--notebook-dir`选项,指定新的工作目录。例如:
```shell
jupyter notebook --notebook-dir="D:\NewDirectory"
```
- 这样每次启动Jupyter Notebook时,它都会使用你指定的目录作为工作区。
记住在操作后重启Jupyter Notebook,使更改生效。如果你经常需要改变工作目录,也可以考虑将这个设置写入`~/.jupyter/jupyter_notebook_config.py`的持久化配置中。
阅读全文
相关推荐

















