得到错误13:尝试保存我的Jupyter笔记本时权限被拒绝

时间:2020-06-25 12:34:22

标签: python ubuntu jupyter-notebook conda jupyter-lab

我在ubuntu上通过conda安装了jupyter笔记本。现在,每当我尝试保存Jupiter笔记本时,都会出现错误13:权限被拒绝。

Saving file at /Documents/Ship-radiated-noise-estimation-using-AI/Random Forest.ipynb
[W 17:57:46.124 NotebookApp] Unexpected error while saving file: Documents/Ship-radiated-noise-estimation-using-AI/Random Forest.ipynb [Errno 13] Permission denied: '/home/avi/Documents/Ship-radiated-noise-estimation-using-AI/.ipynb_checkpoints/Random Forest-checkpoint.ipynb'
[E 17:57:46.125 NotebookApp] {
      "Host": "localhost:8888",
      "Connection": "keep-alive",
      "Content-Length": "57866",
      "Accept": "application/json, text/javascript, */*; q=0.01",
      "X-Requested-With": "XMLHttpRequest",
      "X-Xsrftoken": "2|054c4e1d|fe934c5c5e2843c9e5dab551f16ed9a5|1591886911",
      "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36",
      "Content-Type": "application/json",
      "Origin": "http://localhost:8888",
      "Sec-Fetch-Site": "same-origin",
      "Sec-Fetch-Mode": "cors",
      "Sec-Fetch-Dest": "empty",
      "Referer": "http://localhost:8888/notebooks/Documents/Ship-radiated-noise-estimation-using-AI/Random%20Forest.ipynb",
      "Accept-Encoding": "gzip, deflate, br",
      "Accept-Language": "en-GB,en-US;q=0.9,en;q=0.8",
      "Cookie": "_xsrf=2|054c4e1d|fe934c5c5e2843c9e5dab551f16ed9a5|1591886911; username-localhost-8889=\"2|1:0|10:1592913160|23:username-localhost-8889|44:MDJhM2JjOGJlOTFmNDAwZDg3YzE1ZjU5MzRhZjA3NWE=|2f443fc34809baea4742ba6589e1faf479105f8d6b3518a3583265a16f72888b\"; username-localhost-8888=\"2|1:0|10:1593080616|23:username-localhost-8888|44:Y2M1ZmVkNzEwNWM0NGJiZGFmNDYwNWNlMzVhMTdmNmU=|2692cec91ce0a49620300d2b09fca623208a50442f0e0fcc39c764de38160930\""
    }
[E 17:57:46.125 NotebookApp] 500 PUT /api/contents/Documents/Ship-radiated-noise-estimation-using-AI/Random%20Forest.ipynb (127.0.0.1) 1692.03ms referer=http://localhost:8888/notebooks/Documents/Ship-radiated-noise-estimation-using-AI/Random%20Forest.ipynb

2 个答案:

答案 0 :(得分:0)

您需要将以下目录的权限从root更改为用户。

~/.local/share/jupyter

希望能解决您的问题

答案 1 :(得分:0)

我找到了解决此问题的方法,但此答案可能仅适合我的情况。

因此,问题的原因是我首先使用pip安装了Jupyter笔记本,后来又使用anaconda安装了它,因为如果我没记错的话,由于使用了conda,我无法正确地使用pip配置已安装的笔记本。所以下面是我解决问题的方法。

首先,我卸载了conda。通过使用这些cmd

    rm -rf ~/anaconda3
    rm -rf ~/.condarc ~/.conda ~/.continuum

并编辑〜/ .bachrc以通过删除从PATH环境变量中删除Anaconda目录

    # added by Anaconda3 installer
    export PATH="/home/linuxize/anaconda3/bin:$PATH"

我在终端中使用了所有这些cmd

    pip3 uninstall jupyter
    pip3 uninstall jupyter_core
    pip3 uninstall jupyter-client
    pip3 uninstall jupyter-console
    pip3 uninstall notebook
    pip3 uninstall qtconsole
    pip3 uninstall nbconvert
    pip3 uninstall nbformat

然后我转到/usr/local/lib/python3.8/dist-packages并删除所有jupyter,notebook等目录,然后删除pycache目录中与jupyter相关的python文件。

然后,我终于重新安装了anaconda。我不确定哪些步骤是必需的或不必要的,但这解决了我的问题。