在virtualenv中从jupyter笔记本生成狮身人面像文档时收到“笔记本错误:PermissionError”

我有一个笔记本,无论是否带有virtualenv,它都可以以root身份生成,但是以标准用户身份生成时,它会失败。

$ make html
reading sources... [100%] notebooks/demo_short                                                                                                                                                
Notebook error:
PermissionError in notebooks/demo_short.ipynb:
[Errno 13] Permission denied: '/usr/local/share/jupyter/nbconvert/templates/rst.tpl'
Makefile:19: recipe for target 'html' failed

$ sphinx-build -M html "." "_build" -v
[...]
  File "/home/with_home/p3/lib/python3.6/site-packages/jinja2/loaders.py",line 171,in get_source
    f = open_if_exists(filename)
  File "/home/with_home/p3/lib/python3.6/site-packages/jinja2/utils.py",line 154,in open_if_exists
    return open(filename,mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/share/jupyter/nbconvert/templates/rst.tpl'

During handling of the above exception,another exception occurred:

[...]
  File "/home/with_home/p3/lib/python3.6/site-packages/docutils/readers/__init__.py",line 77,in parse
    self.parser.parse(self.input,document)
  File "/home/with_home/p3/lib/python3.6/site-packages/nbsphinx.py",line 869,in parse
    str(e))
nbsphinx.NotebookError: PermissionError in notebooks/demo_short.ipynb:
[Errno 13] Permission denied: '/usr/local/share/jupyter/nbconvert/templates/rst.tpl'

Notebook error:
PermissionError in notebooks/demo_short.ipynb:
[Errno 13] Permission denied: '/usr/local/share/jupyter/nbconvert/templates/rst.tpl'

我认为指示的路径是错误的,因为它应该指向我的virtualenv中的某个位置,但是我不确定。

如果有帮助,我尝试了virtualenv中的命令jupyter nbconvert notebooks/demo_short.ipynb。有了root,就可以了,但是对于标准用户,我有:

[...]
  File "/home/with_home/.local/lib/python3.6/site-packages/nbconvert/exporters/templateexporter.py",line 78,in get_source
    return self.loader.get_source(environment,template)
  File "/usr/lib/python3/dist-packages/jinja2/loaders.py",in get_source
    f = open_if_exists(filename)
  File "/usr/lib/python3/dist-packages/jinja2/utils.py",mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/share/jupyter/nbconvert/templates/html/full.tpl'

欢迎使用任何指针,因为我不知道pb是来自狮身人面像,jupyter,nbconvert,nbsphinx还是模板。

hrslhjbgfdk 回答:在virtualenv中从jupyter笔记本生成狮身人面像文档时收到“笔记本错误:PermissionError”

将 nbconvert 降级到 5.6.1,为我解决了权限问题。

,

导航到 ~/.local/share/ ,使用 rm -rf Jupyter 删除Jupyter目录,然后尝试再次打开jupyter笔记本。

,

我只是在终端中打印:

sudo jupyter notebook --allow-root

然后输入密码,Jupyter Notebook 就可以工作了。

本文链接:https://www.f2er.com/2927799.html

大家都在问