python - 如何更改 Anaconda 的默认目录?
问题描述
我喜欢学习python。因此,我在我的 MacBook(Mac OS X High Sierra)上安装了 Anaconda。在我使用 JupyterLab 的第一个绊脚石步骤之后,我意识到所有笔记本和 txt 文件都保存在我的主目录中。但是,我喜欢让文件夹保持整洁。如何更改默认文件夹目录?
因此,我生成了 Jupyter 配置文件
jupyter notebook --generate-config
然后我将笔记本目录行更改为:
c.NotebookApp.notebook_dir = '/Users/name/folder/Python_scripts/'
重新启动 Jupyter 后,我期待新文件存放在新文件夹中,但没有任何改变。新文件仍保存在主目录中。
解决方案
默认情况下,Jupyter notebook 将使用终端会话的当前工作目录。使用 jupyter 在终端中执行您要查找的操作:
jupyter notebook --notebook-dir=<some_directory>
这会将内核设置为 in<some_directory>
通常您希望从您想要的目录中启动 jupyter:
cd <directory_you_want>
jupyter notebook
移动你的文件(我假设你想移动你所有的笔记本):
cd ~ && find *.ipynb print0 | xargs -0 -I {} mv {} <directory_you_want>
推荐阅读
- amazon-web-services - 修改 AWS 切换角色显示名称
- firebase - 我可以使用 firebase 创建以下后端(是否可能)?
- sql-server - SQL Server 对象资源管理器中的缺失任务选项
- python - chown: 无法访问 '/var/lib/odoo': 没有这样的文件或目录
- python - 除非我包含错误的代码行,否则 PYTHON 无法显示图像
- flutter - 如何将按下按钮的颜色更改为绿色,将行中的其他按钮颜色更改为中性
- java - ApacheBeam-Java:MS-SQL - 子查询返回超过 1 个值
- android - 在 Windows 操作系统上使用 react-native 时如何生成 android 签名密钥?
- arduino - 实现 micros() 来控制 Arduino SPI 时序
- java - 运行 Spring Boot Azure Function App 时出错