jupyter notebook怎么更改保存路径
时间: 2023-09-14 08:03:13 浏览: 1363
你可以通过更改Jupyter Notebook的配置文件来更改保存路径。请按照以下步骤操作:
1. 打开终端(或命令提示符)并输入以下命令,以找到Jupyter Notebook的配置文件所在的文件夹:
```bash
jupyter notebook --generate-config
```
2. 这将生成一个名为`jupyter_notebook_config.py`的配置文件。找到该文件的路径。
3. 使用你喜欢的文本编辑器打开`jupyter_notebook_config.py`文件。
4. 在文件中找到以下行:
```python
# c.NotebookApp.notebook_dir = ''
```
5. 将`c.NotebookApp.notebook_dir`的值更改为你想要保存Jupyter Notebook文件的路径。例如,如果你想将文件保存在`/path/to/my/notebooks`文件夹中,将该行更改为:
```python
c.NotebookApp.notebook_dir = '/path/to/my/notebooks'
```
6. 保存并关闭文件。
7. 重新启动Jupyter Notebook服务器。
现在,你的Jupyter Notebook将默认保存到你指定的路径下。
相关问题
修改jupyter notebook默认保存路径
在Jupyter Notebook中,你可以通过修改环境变量来更改默认的保存路径。这通常是针对系统级别的设置,而不是单个Notebook文件的行为。以下是Windows、Linux和Mac OS X系统的步骤:
**Windows:**
1. 打开命令提示符(PowerShell或cmd)。
2. 输入以下命令:
```
set JUPYTER_CONFIG_DIR=C:\path\to\your\directory
```
将`C:\path\to\your\directory`替换为你想要设置的目录。
**Linux/Mac OS X (终端):**
1. 打开终端。
2. 运行 `export JUPYTER_CONFIG_DIR=/path/to/your/directory`。
将`/path/to/your/directory`替换为你选择的路径。
记得保存这个环境变量设置,以便每次启动新的Jupyter会话时都生效。如果你希望永久改变,可以在`~/.bashrc`(Linux)或`~/.zshrc`(macOS及某些Linux发行版)文件中添加上述设置。
jupyter notebook文件保存路径
Jupyter Notebook 文件的默认保存路径是在用户的主文件夹下的 ".jupyter" 文件夹中,具体路径为:
- Windows 系统:C:\Users\你的用户名\.jupyter
- Mac/Linux 系统:/Users/你的用户名/.jupyter
如果你想修改默认保存路径,可以通过修改 Jupyter Notebook 的配置文件来实现。你可以打开终端或命令行窗口,输入以下命令来打开配置文件:
```
jupyter notebook --generate-config
```
然后找到生成的配置文件(一般在用户主文件夹下的 ".jupyter" 文件夹中),用文本编辑器打开并编辑即可。在配置文件中搜索 "NotebookApp.notebook_dir",将其设置为你想要保存的路径即可。
阅读全文
相关推荐














