ModuleNotFoundError:没有名为“notebook.auth”的模块

xan*_*exu 1 python jupyter

我正在从远程服务器设置 Jupyter 笔记本环境。当我导入notebook.auth它时报告如下错误:

>>> from notebook.auth import passwd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'notebook.auth'
Run Code Online (Sandbox Code Playgroud)

我的jupyter参数是这样的:

Selected Jupyter core packages...
IPython          : 8.2.0
ipykernel        : 6.25.0
ipywidgets       : 8.1.0
jupyter_client   : 8.1.0
jupyter_core     : 5.3.0
jupyter_server   : 2.7.2
jupyterlab       : 4.0.5
nbclient         : 0.8.0
nbconvert        : 7.2.9
nbformat         : 5.9.2
notebook         : 7.0.2
qtconsole        : 5.4.3
traitlets        : 5.7.1
Run Code Online (Sandbox Code Playgroud)

有谁知道如何解决这个问题?我已经尝试过 pip install jupyter 。它根本不起作用。

谢谢,

Wes*_*ung 6

从 Jupyter Notebook 7 开始,使用该jupyter_server.auth模块而不是notebook.auth

$ jupyter server password
Enter password:  ****
Verify password: ****
[JupyterPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_server_config.json
Run Code Online (Sandbox Code Playgroud)

或 ipython:

from jupyter_server.auth import passwd
passwd()
Run Code Online (Sandbox Code Playgroud)

参考: