怎么知道anaconda下jupyter notebook中文件的存储位置
时间: 2023-10-22 07:11:42 浏览: 325
在jupyter notebook中使用以下代码可以查看文件的存储位置:
```python
import os
os.getcwd()
```
该代码会输出当前jupyter notebook工作目录的路径。在该路径下可以找到你所创建的文件。如果你想更改文件的存储位置,可以使用以下代码:
```python
import os
os.chdir('your/new/path')
```
该代码会将jupyter notebook的工作目录更改为新的路径。在新路径下创建的文件将会保存在该路径下。
相关问题
jupyter notebook修改文件位置
### 更改 Jupyter Notebook 默认保存文件的位置
为了更改 Jupyter Notebook 的默认工作目录或文件保存位置,可以按照以下方法操作:
#### 创建并编辑配置文件
通过 Anaconda Prompt 或者命令提示符执行命令 `jupyter notebook --generate-config` 来创建配置文件[^4]。此命令会在用户的主目录下生成一个名为 `.jupyter/jupyter_notebook_config.py` 的文件。
#### 修改配置文件中的参数
找到上述路径下的 `jupyter_notebook_config.py` 文件,并使用文本编辑器打开它[^3]。在该文件内寻找如下设置项并将之取消注释(删除前面的 `#`),同时将其值更改为期望的新默认目录绝对路径:
```python
c.NotebookApp.notebook_dir = 'D:\\MyNotebooks'
```
这里 `'D:\\MyNotebooks'` 应替换为实际想要作为新的默认存储位置的具体地址。注意要确保所选路径存在并且具有读写权限。
完成这些改动之后重启 Jupyter Notebook 服务即可生效。此时再创建新的笔记本将会自动存放在指定好的新位置中[^1]。
jupyter notebook修改存储位置
要修改Jupyter Notebook的存储位置,可以按照以下步骤进行操作:
1. 打开Anaconda Prompt。
2. 输入命令`jupyter notebook --generate-config`生成配置文件。
3. 根据上述命令运行处的路径,找到`C:\Users\HS\.jupyter\jupyter_notebook_config.py`文件。
4. 打开配置文件,找到`#c.NotebookApp.notebook_dir = ''`这一行,去掉前面的“#”。
5. 在打算存放文件的位置先新建一个文件夹(很重要),然后将新的路径设置在单引号中。
6. 保存配置文件。
7. 在开始菜单中找到“Jupyter Notebook”的快捷键,鼠标右击,选择“更多”,然后点击“打开文件位置”。
8. 找到相应的“Jupyter Notebook”快捷键,鼠标右击,选择“属性”,然后点击“目标”。
9. 去掉目标路径后面的“%USERPROFILE%/”(很重要),然后点击“应用”和“确定”。
10. 重新启动Jupyter Notebook即可。
阅读全文
相关推荐
















