美文网首页jupyter
JupyterLab初始目录修改(2022-01-20)

JupyterLab初始目录修改(2022-01-20)

作者: 予怀兮渺渺 | 来源:发表于2022-01-20 10:00 被阅读0次

    对于JupyterLab,可以采用以往设置Notebook的方法进行设置。网上有很多,如[1],这里不赘述。

    Jupyter官方给出了JupyterLab初始目录的设置方法[2]:修改jupyter_lab_config.py文件中的c.ServerApp.root_dir字段

    step1:生成jupyter_lab_config.py文件

    jupyter_lab_config.py文件默认不存在,需要显式生成。在anaconda命令行中输入如下:

    jupyter lab --generate-config
    

    生成的config文件在:

     C:\Users\{Your User Name}\.jupyter\jupyter_lab_config.py
    

    step2:修改config文件

    在jupyter_lab_config.py文件中找到以下字段,在引号内填入你想要的初始目录即可

    c.ServerApp.root_dir = ''
    

    配置文件中写道,原有的notebook_dir变成deprecated了,估计以后不再支持。

    ## DEPRECATED, use root_dir.
    
    #  Default: ''
    
    # c.ServerApp.notebook_dir = ''
    

    Reference

    [1] jupyter notebook更改默认文件目录的方法
    [2] https://docs.jupyter.org/en/latest/use/config.html#the-python-config-file

    相关文章

      网友评论

        本文标题:JupyterLab初始目录修改(2022-01-20)

        本文链接:https://www.haomeiwen.com/subject/plcjhrtx.html