haibaraxx的个人博客分享 http://blog.sciencenet.cn/u/haibaraxx

博文

Python: mac下Jupyter notebook改变默认目录路径

已有 17087 次阅读 2017-9-27 22:49 |个人分类:Python|系统分类:科研笔记| 目录, Notebook, Jupyter

1 永久更改Jupyter notebook默认目录路径

1) 创建Jupyter notebook的配置文件jupyter_notebook_config.py,在终端中输入:

\$ jupyter notebook --generate-config


2) 打开jupyter_notebook_config.py,找到如下文字:

## The default URL to redirect to from `/`
#c.NotebookApp.default_url = '/tree'


将其修改为:

## The default URL to redirect to from `/`
c.NotebookApp.default_url = '/tree/Coding'

此时,Jupyter notebook的默认目录路径就变成了/home/Coding, 即Users/yliu/Coding

注:该方法只能通过home目录启动Jupyter notebook,从其他目录启动会出现Jupyter notebook网页无法显示的状态。即启动方式如下(终端):

\$ yliu-16:52:26:~\$ ipython notebook

而不能是: \$ yliu-16:53:53:Coding\$ ipython notebook


2 单次更改Jupyter notebook默认目录路径

1)在终端中cd到目标目录:

cd ~/Coding

2) \$ yliu-16:53:53:Coding\$ ipython notebook

注:该方法的前提是不对Jupyter notebook的配置文件jupyter_notebook_config.py做任何更改。



https://wap.sciencenet.cn/blog-3031432-1078057.html

上一篇:Python:Pandas之DataFrame
收藏 IP: 134.1.1.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-25 07:27

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部