linux/Ubuntu 16.04/Ubuntu 18.04 下修改Jupyter notebook默认路径

在终端中切换到某目录,再打开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'
发布了103 篇原创文章 · 获赞 16 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/sunmingyang1987/article/details/104105573