Jupyter笔记本权限错误

时间:2016-03-08 21:16:51

标签: python ipython anaconda jupyter

我在打开Jupyter时遇到了一些问题。我刚刚安装了Anaconda,但是当我尝试编写" 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'

由于我对此完全无能为力,我需要一些帮助:)

8 个答案:

答案 0 :(得分:11)

解决方案是作为普通用户在终端上运行以下命令

$ export XDG_RUNTIME_DIR =“” 然后开始jupyter $ jupyter notebook

它不能以root用户身份运行

答案 1 :(得分:7)

有了它的工作,这是答案:

var obj = [2, 3, 7].reduce((a,b,i) => (a[b] = i, a), {});

答案 2 :(得分:1)

  1. 您可能在初始安装程序userid
  2. 下工作
  3. 转到Ananconda提示并使用这两个命令>cd..>cd yourusername更改目录。
  4. 使用命令

    jupyter notebook

  5. 这对我有用。

答案 3 :(得分:0)

权限错误可能是由于目录不在777模式下引起的。 请遵循以下命令,它对我有用:

sudo chmod -R 777 .local

您可以根据目录中发生的错误来更改“ .local”目录。

答案 4 :(得分:0)

以root身份执行:

sudo nano  ~/.bashrc

在文件开头添加:

 export XDG_RUNTIME_DIR="" 

Ctrl-o写入文件,按Ctrl+x退出。

现在输入:

source ~/.bashrc 

如果这样不起作用,请卸载Jupyter Notebook,并让当前用户(例如joe)拥有该文件夹(以及文件夹本身)中的所有内容:

sudo chown -R $joe:joe /home/joe/.jupyter

pip install notebook --user

答案 5 :(得分:0)

当我在Win 10中遇到“ Jupyter笔记本权限错误”时,对我有用的是在管理员模式下运行终端,然后从那里编写“ Jupyter笔记本”。

答案 6 :(得分:0)

我运行“whereis jupyter”得到以下输出:

/snap/bin/jupyter /snap/bin/jupyter.ipython /snap/bin/jupyter.nbconvert

然后我运行了以下命令:

sudo chmod -R 755 /snap/bin/jupyter

以前,我试图为打开 Jupyter 笔记本的文件夹设置权限。它不起作用。好像需要给jupyter所在的文件夹设置权限。

答案 7 :(得分:-1)

我也遇到了类似这样的问题:

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,就可以了。

命令:

pip3 install --upgrade jupyter

如果您再次使用以下命令: pip3安装jupyter 它只是打印已经安装 但某些相关模块未更新