在终端中切换到某目录,再打开jupyter notebook,notebook默认的路径就是当前目录,但是却不能到达上一级目录。可以通过以下方法将jupyter默认路径设置你的账户名下的目录,这样任何时候都可以在notebook中浏览你的用户名下的所有文件夹。
第一步:创建Jupyter notebook的配置文件jupyter_notebook_config.py
在终端中输入:
jupyter notebook --generate-config
第二步:打开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'
这时默认目录对应的就是“home/用户名”
如果要将默认目录修改为你用户名下的某个目录,例如“Python”这个文件夹,则将以上代码修改为:
## The default URL to redirect to from `/`
c.NotebookApp.default_url = '/tree/Python'