Jupyter 笔记本未运行 [PermissionError:[Errno 13] 权限被拒绝:'/home/user]

Jupyter 笔记本未运行 [PermissionError:[Errno 13] 权限被拒绝:'/home/user]

我尝试使用命令卸载 jupyter notebookpip uninstall jupyter_core并重新安装,但没有成功。还尝试了这个命令pip-autoremove jupyter -y并重新安装,也没有成功。还卸载了它并尝试了这个命令从 snapd 文件夹中删除缓存,但sudo sh -c 'rm -rf /var/lib/snapd/cache/*'还是没有成功。

我已经尽力了请帮助我

abuhaithem@abuhaithem:~$ jupyter notebook
Traceback (most recent call last):
  File "/home/abuhaithem/.local/lib/python3.10/site-packages/traitlets/traitlets.py", line 645, 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 "/home/abuhaithem/.local/bin/jupyter-notebook", line 8, in <module>
    sys.exit(main())
  File "/home/abuhaithem/.local/lib/python3.10/site-packages/jupyter_core/application.py", line 269, in launch_instance
    return super().launch_instance(argv=argv, **kwargs)
  File "/home/abuhaithem/.local/lib/python3.10/site-packages/traitlets/config/application.py", line 981, in launch_instance
    app.initialize(argv)
  File "/home/abuhaithem/.local/lib/python3.10/site-packages/traitlets/config/application.py", line 110, in inner
    return method(app, *args, **kwargs)
  File "/home/abuhaithem/.local/lib/python3.10/site-packages/notebook/notebookapp.py", line 2147, in initialize
    self.init_configurables()
  File "/home/abuhaithem/.local/lib/python3.10/site-packages/notebook/notebookapp.py", line 1649, in init_configurables
    connection_dir=self.runtime_dir,
  File "/home/abuhaithem/.local/lib/python3.10/site-packages/traitlets/traitlets.py", line 686, in __get__
    return self.get(obj, cls)
  File "/home/abuhaithem/.local/lib/python3.10/site-packages/traitlets/traitlets.py", line 648, in get
    default = obj.trait_defaults(self.name)
  File "/home/abuhaithem/.local/lib/python3.10/site-packages/traitlets/traitlets.py", line 1752, in trait_defaults
    return self._get_trait_default_generator(names[0])(self)
  File "/home/abuhaithem/.local/lib/python3.10/site-packages/jupyter_core/application.py", line 106, in _runtime_dir_default
    ensure_dir_exists(rd, mode=0o700)
  File "/home/abuhaithem/.local/lib/python3.10/site-packages/jupyter_core/utils/__init__.py", line 12, in ensure_dir_exists
    os.makedirs(path, mode=mode)
  File "/usr/lib/python3.10/os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/lib/python3.10/os.py", line 225, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/home/user'

答案1

我找到了答案

1.首先打开你的终端并卸载 jupyter notebook
pip uninstall jupyter_core
2. 然后输入以下内容
ls -a
3.然后删除.cache文件夹
rm -r .cache
4.并删除此文件夹
rm -r .pam_environment
5完成所有这些步骤后,最终重新安装 jupyter notebook
pip install notebook

相关内容