如何修改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图标会不见,重新添加一个即可

相关推荐
小小测试开发2 小时前
安装 Python 3.10+
开发语言·人工智能·python
梦想不只是梦与想3 小时前
Python 中的装饰器
python·装饰器
我叫唧唧波3 小时前
Python+AI 全栈学习笔记
人工智能·python·学习
copyer_xyf4 小时前
Python 异常处理
前端·后端·python
麻雀飞吧4 小时前
期货多合约策略目标持仓怎么更新才不乱
python·区块链
Cthy_hy5 小时前
拓扑排序超详解:原理 + Kahn 贪心算法
python·算法·贪心算法
LSssT.5 小时前
【01】Python 机器学习
开发语言·python
为爱停留5 小时前
给智能体装上「刹车」:中断(Interrupts)与人工审批全解析
python
l1t5 小时前
DeepSeek总结的使用实体-组件-系统和基于存在性处理进行Python编程39-40
开发语言·python
曾阿伦6 小时前
Python 搭建简易HTTP服务
开发语言·python·http