Jupyter/iPython Notebook的Root访问权限

use*_*390 9 bash ipython ipython-notebook jupyter-notebook

我正在尝试在iPython/Jupyter笔记本中使用bash内核,但我需要在笔记本本身内进行sudo访问.

我试图$ sudo jupyter notebook以root身份运行笔记本,但这只会返回:

$ jupyter: 'notebook' is not a Jupyter command
Run Code Online (Sandbox Code Playgroud)

所以,我离开了跑步$ jupyter notebook(除非有办法以root身份运行Jupyter笔记本).

我也不能su root在笔记本本身做,因为这需要输入,笔记本不会让我给出一个输入.

最后,据称--allow-rootJupyter笔记本有一个选项:http://jupyter-notebook.readthedocs.io/en/latest/config.html

但是,看起来--allow_root不再是一种选择.(我尝试通过添加来修改配置文件NotebookApp.allow_root=True,但这不起作用.)

有什么想法吗?也许我做错了什么?

An0*_*n0n 10

Just login as root, then do the following command to start the notebook :

jupyter notebook --allow-root
Run Code Online (Sandbox Code Playgroud)


Aet*_*tos 9

此处描述的解决方案。是用

sudo -E env "PATH=$PATH" jupyter notebook
Run Code Online (Sandbox Code Playgroud)

基本上要调用的二进制文件jupyter notebook在用户的PATH变量中,但不适用于 root。

此致。

  • *****这才是这个问题的真正解决方案!! (2认同)

tia*_*ves 5

c.NotebookApp.allow_root=True从根配置文件添加。allow-root每次启动笔记本时都不需要询问。

编辑:

在编辑配置文件之前,您需要以jupyter notebook --generate-configroot用户身份运行以制作该文件。