如何修改jupyter notebook默认打开路径

1、用jupyter notebook在其他位置打开自己的ipython项目:

jupyter notebook是一个很好用的工具,可以保存运行结果,还可以给项目添加很多可视化操作与介绍文字。安装anaconda后,jupyter notebook就会自动安装,点开它会是一个默认的工作路径,当我们需要在别的地方打开自己的项目时,需要进入命令行:

首先切换盘符:

shell 复制代码
A:

cd到项目位置:

shell 复制代码
cd A:\traffic_flow_prediction\ASTGCN

打开jupyter notebook:

shell 复制代码
jupyter notebook

但是这样也有点麻烦,点击jupyter notebook的图标自己打开默认路径多好

2、修改jupyter notebook默认打开路径

1、查看配置文件位置:

shell 复制代码
jupyter notebook --generate-config

比如我的显示在这里:

C:\Users\18333.jupyter

2、在本地磁盘进入这个位置,打开这个文件

jupyter_notebook_config.py

3、找到这行代码:

python 复制代码
# c.NotebookApp.notebook_dir = ''

修改为:

python 复制代码
c.NotebookApp.notebook_dir = '项目地址'

记得保存,我的在第450行,你可以通过搜索找到

4、找到jupyter_notebook图标

选择打开文件位置,找到图标,比如我的是:

右键属性:

修改目标,删除这个内容即可:

"%USERPROFILE%/"

比如我的原本是:

C:\Users\18333\anaconda3\python.exe C:\Users\18333\anaconda3\cwp.py C:\Users\18333\anaconda3 C:\Users\18333\anaconda3\python.exe C:\Users\18333\anaconda3\Scripts\jupyter-notebook-script.py "%USERPROFILE%/"

删除后就是:

C:\Users\18333\anaconda3\python.exe C:\Users\18333\anaconda3\cwp.py C:\Users\18333\anaconda3 C:\Users\18333\anaconda3\python.exe C:\Users\18333\anaconda3\Scripts\jupyter-notebook-script.py

到这里就结束了,应该没什么问题,不过你的jupyter_notebook图标会不见,重新添加一个即可

相关推荐
金銀銅鐵14 小时前
用 Python 实现 Take-Away 游戏
python·游戏
copyer_xyf15 小时前
Agent 流程编排
后端·python·agent
copyer_xyf15 小时前
Agent RAG
后端·python·agent
copyer_xyf15 小时前
【RAG】向量数据库:milvus
后端·python·agent
copyer_xyf15 小时前
Agent 记忆管理
后端·python·agent
星云穿梭1 天前
用Python写一个带图形界面的学生管理系统——完整教程
python
金銀銅鐵1 天前
用 Pygame 实现 15 puzzle
python·数学·游戏
黄忠2 天前
大模型之LangGraph技术体系
python·llm
hboot2 天前
AI工程师第二课 - 数据处理
人工智能·python·数据分析
用户8356290780512 天前
使用 Python 自动化 PowerPoint 形状布局与格式设置
后端·python