2016-03-08 199 views
2

我在打開Jupyter時遇到了一些問題。我剛剛安裝了Anaconda,但當我嘗試在終端中寫入「Jupyter notebook」時遇到了與以前相同的錯誤。Jupyter筆記本權限錯誤

Johans-MBP:~ JDMac$ Jupyter notebook 
Traceback (most recent call last): 
    File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 501, in get 
    value = obj._trait_values[self.name] 
KeyError: 'runtime_dir' 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "/Users/JDMac/anaconda3/bin/jupyter-notebook", line 6, in <module> 
    sys.exit(notebook.notebookapp.main()) 
    File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/jupyter_core/application.py", line 267, in launch_instance 
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs) 
    File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 588, in launch_instance 
    app.initialize(argv) 
    File "<decorator-gen-7>", line 2, in initialize 
    File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 74, in catch_config_error 
    return method(app, *args, **kwargs) 
    File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/notebook/notebookapp.py", line 1021, in initialize 
    self.init_configurables() 
    File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/notebook/notebookapp.py", line 815, in init_configurables 
    connection_dir=self.runtime_dir, 
    File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 529, in __get__ 
    return self.get(obj, cls) 
    File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 508, in get 
    value = self._validate(obj, dynamic_default()) 
    File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/jupyter_core/application.py", line 99, in _runtime_dir_default 
    ensure_dir_exists(rd, mode=0o700) 
    File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/ipython_genutils/path.py", line 167, in ensure_dir_exists 
    os.makedirs(path, mode=mode) 
    File "/Users/JDMac/anaconda3/lib/python3.5/os.py", line 241, in makedirs 
    mkdir(name, mode) 
PermissionError: [Errno 13] Permission denied: '/Users/JDMac/Library/Jupyter/runtime' 

我敢親近所有這一切毫無頭緒,我需要一些幫助在這裏:)

回答

5

得到它的工作,這裏是答案:

sudo chown -R `whoami`:staff ~/Library/Jupyter 
+0

我沒有看到任何名爲'Jupyter'的文件夾。只是一個'.jupyter'。它已經由我當前的用戶擁有。任何關於哪些文件需要擁有的線索? – davneet

+0

對不起,我不明白,你自己會遇到這個錯誤還是糾正? @davneet – joddm

+0

我自己也遇到了這個錯誤。 – davneet

4

解決方案在終端上運行以下命令作爲普通用戶

$ export XDG_RUNTIME_DIR =「」 然後啓動jupyter $ jupyter notebook

它不會作爲根用戶工作

+1

這暫時解決了問題,但不是永久解決問題。當我再次登錄時,問題會再次出現。 –

+0

你可以將它添加到〜/ .bashrc文件 –

0

我也遇到了類似的問題是這樣的:

jupyter notebook 
Traceback (most recent call last): 
    File "c:\p\py353\lib\site-packages\traitlets\traitlets.py", line 528, in get 
    value = obj._trait_values[self.name] 
KeyError: 'log' 
... 

我安裝jupyter使用PyCharm 所以只需更新jupyter,這是sovled。

命令:

pip3 install --upgrade jupyter 

如果您使用以下命令再次: PIP3安裝jupyter 它只是打印已經安裝 但一些相關模塊沒有更新

+0

它解決了我的問題:執行Jupyter命令'notebook'時出錯:[Errno 13]運行時權限被拒絕'''jupyter notebook''' –

1
  1. 您可能在初始安裝程序下工作userid
  2. 轉到Ananconda pr ompt並用這兩個命令更改目錄>cd..>cd yourusername
  3. 使用命令

    jupyter notebook

這爲我工作。