环境变量中的JUPYTER_PATH不起作用

时间:2017-12-05 18:35:46

标签: python anaconda jupyter-notebook jupyter

我正在尝试为Jupyter笔记本更新JUPYTER_PATH。我在the jupyter documentation之后设置了环境变量,但仍然jupyter contrib nbextension install --user,例如,安装在C:\Users\username\AppData\nbextensions而不是C:\somedir\AppData\Roaming\jupyter\nbextensions下。

将这些添加到我的环境变量中。

JUPYTER_CONFIG_DIR=C:\somedir\.jupyter
JUPYTER_PATH=C:\somedir\AppData\Roaming\jupyter
JUPYTER_RUNTIME_DIR=C:\somedir\AppData\Roaming\jupyter

jupyter --path显示

PS C:\somedir\> jupyter --path
config:
    C:\somedir\.jupyter
    C:\anaconda\python27\win64\431\etc\jupyter
    C:\ProgramData\jupyter
data:
    C:\somedir\AppData\Roaming\jupyter
    C:\Users\username\AppData\Roaming\jupyter
    C:\anaconda\python27\win64\431\share\jupyter
    C:\ProgramData\jupyter
runtime:
    C:\somedir\AppData\Roaming\jupyter

jupyter --data-dir显示

jupyter --data-dir
C:\Users\username\AppData\Roaming\jupyter

我认为C:\Users\username\AppData\Roaming\jupyter需要被移除,但也不确定如何。你能帮忙吗?

1 个答案:

答案 0 :(得分:2)

要设置用户数据目录,您应该使用JUPYTER_DATA_DIR环境变量,在您设置为C:\somedir\AppData\Roaming\jupyter的情况下。您也可以取消设置JUPYTER_PATH(详见下文)。

虽然从文档中看不是很明显,但是nbextension install命令不会注意JUPYTER_PATH环境变量,因为它不使用jupyter_core.paths.jupyter_path函数,而是使用jupyter_core.paths.jupyter_data_dir来直接构造用户数据nbextensions目录。

C:\Users\username\AppData\Roaming\jupyter 输出的数据部分中的条目jupyter --paths 是用户数据目录,因为除JUPYTER_PATH之外还使用了<{1}} 其他条目,而不是替换任何条目。出于您的目的,我建议您取消设置JUPYTER_PATH,因为如果没有它,您可以得到您想要的内容。

相关问题