错误详情:
(ironbank)deploy@app10:~/ironbank$ jupyter notebook --port 9191
Traceback (most recent call last):
File "/home/deploy/.virtualenvs/ironbank/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/home/deploy/.virtualenvs/ironbank/local/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/deploy/.virtualenvs/ironbank/local/lib/python2.7/site-packages/traitlets/config/application.py", line 588, in launch_instance
app.initialize(argv)
File "<decorator-gen-115>", line 2, in initialize
File "/home/deploy/.virtualenvs/ironbank/local/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/home/deploy/.virtualenvs/ironbank/local/lib/python2.7/site-packages/notebook/notebookapp.py", line 1005, in initialize
self.init_configurables()
File "/home/deploy/.virtualenvs/ironbank/local/lib/python2.7/site-packages/notebook/notebookapp.py", line 804, in init_configurables
connection_dir=self.runtime_dir,
File "/home/deploy/.virtualenvs/ironbank/local/lib/python2.7/site-packages/traitlets/traitlets.py", line 529, in __get__
return self.get(obj, cls)
File "/home/deploy/.virtualenvs/ironbank/local/lib/python2.7/site-packages/traitlets/traitlets.py", line 508, in get
value = self._validate(obj, dynamic_default())
File "/home/deploy/.virtualenvs/ironbank/local/lib/python2.7/site-packages/jupyter_core/application.py", line 99, in _runtime_dir_default
ensure_dir_exists(rd, mode=0o700)
File "/home/deploy/.virtualenvs/ironbank/local/lib/python2.7/site-packages/ipython_genutils/path.py", line 167, in ensure_dir_exists
os.makedirs(path, mode=mode)
File "/home/deploy/.virtualenvs/ironbank/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/run/user/999/jupyter'
解决过程:
使用命令:
(ironbank)deploy@app10:~/ironbank$ jupyter --path
发现以下输出:
config:
/home/deploy/.jupyter
/home/deploy/.virtualenvs/ironbank/etc/jupyter
/usr/local/etc/jupyter
/etc/jupyter
data:
/home/deploy/.local/share/jupyter
/home/deploy/.virtualenvs/ironbank/share/jupyter
/usr/local/share/jupyter
/usr/share/jupyter
runtime:
/run/user/999/jupyter
看着样子好像是修改 runtime 的设置就可以了,google 一下怎么设置 runtime。 找了大半天终于找到一篇文档: https://jupyter.readthedocs.org/en/latest/system.html#configuration 只需要修改 XDG_RUNTIME_DIR 环境变量的值就可以了。
export XDG_RUNTIME_DIR="/home/deploy/.virtualenvs/ironbank"
这时再执行:
jupyter notebook --port 9191
就跑起来了。