欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ubuntu配置jupyter

程序员文章站 2022-05-29 07:58:40
...

ubuntu安装Anaconda3之后会自动安装jupyter,Anaconda下载地址推荐清华大学的下载地址,具体安装教程请看这里

进入Anaconda虚拟环境后,cd到想要打开文件()的目录,输入

jupyter notebook

然后会报一大堆错误,如下:

Traceback (most recent call last):
      File "/home/user07/anaconda3/lib/python3.6/site-packages/notebook/base/handlers.py", line 516, in wrapper
        result = yield gen.maybe_future(method(self, *args, **kwargs))
      File "/home/user07/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1055, in run
        value = future.result()
      File "/home/user07/anaconda3/lib/python3.6/site-packages/tornado/concurrent.py", line 238, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 4, in raise_exc_info
      File "/home/user07/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 307, in wrapper
        yielded = next(result)
      File "/home/user07/anaconda3/lib/python3.6/site-packages/notebook/services/contents/handlers.py", line 124, in get
        path=path, type=type, format=format, content=content,
      File "/home/user07/anaconda3/lib/python3.6/site-packages/notebook/services/contents/filemanager.py", line 384, in get
        model = self._notebook_model(path, content=content)
      File "/home/user07/anaconda3/lib/python3.6/site-packages/notebook/services/contents/filemanager.py", line 344, in _notebook_model
        self.mark_trusted_cells(nb, path)
      File "/home/user07/anaconda3/lib/python3.6/site-packages/notebook/services/contents/manager.py", line 456, in mark_trusted_cells
        trusted = self.notary.check_signature(nb)
      File "/home/user07/anaconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 556, in __get__
        return self.get(obj, cls)
      File "/home/user07/anaconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 535, in get
        value = self._validate(obj, dynamic_default())
      File "/home/user07/anaconda3/lib/python3.6/site-packages/notebook/services/contents/manager.py", line 58, in _notary_default
        return sign.NotebookNotary(parent=self)
      File "/home/user07/anaconda3/lib/python3.6/site-packages/nbformat/sign.py", line 392, in __init__
        self.store = self.store_factory()
      File "/home/user07/anaconda3/lib/python3.6/site-packages/nbformat/sign.py", line 340, in factory
        return SQLiteSignatureStore(self.db_file)
      File "/home/user07/anaconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 556, in __get__
        return self.get(obj, cls)
      File "/home/user07/anaconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 535, in get
        value = self._validate(obj, dynamic_default())
      File "/home/user07/anaconda3/lib/python3.6/site-packages/nbformat/sign.py", line 351, in _db_file_default
        if not self.data_dir:
      File "/home/user07/anaconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 556, in __get__
        return self.get(obj, cls)
      File "/home/user07/anaconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 535, in get
        value = self._validate(obj, dynamic_default())
      File "/home/user07/anaconda3/lib/python3.6/site-packages/nbformat/sign.py", line 328, in _data_dir_default
        return app.data_dir
      File "/home/user07/anaconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 556, in __get__
        return self.get(obj, cls)
      File "/home/user07/anaconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 535, in get
        value = self._validate(obj, dynamic_default())
      File "/home/user07/anaconda3/lib/python3.6/site-packages/jupyter_core/application.py", line 93, in _data_dir_default
        ensure_dir_exists(d, mode=0o700)
      File "/home/user07/anaconda3/lib/python3.6/site-packages/ipython_genutils/path.py", line 167, in ensure_dir_exists
        os.makedirs(path, mode=mode)
      File "/home/user07/anaconda3/lib/python3.6/os.py", line 220, in makedirs
        mkdir(name, mode)
    PermissionError: [Errno 13] Permission denied: '/home/user07/.local/share/jupyter'

主要原因就是最后一句,anaconda3中os.py有一个在文件夹'/home/user07/.local/share/jupyter'下的mkdir操作,而当前用户没有权限,所以需要:

sudo chmod 777 ~/.local/share/

再次输入:

jupyter notebook

大功告成!

相关标签: jupyter Anaconda