VS Code Jupyter Notebook:找不到 IProgress

lia*_*mhp 6 python progress-bar jupyter-notebook ipywidgets tqdm

我正在尝试运行一个非常简单的 tqdm 脚本:

from tqdm.notebook import tqdm
for i in tqdm(range(10)):
    time.sleep(1)
Run Code Online (Sandbox Code Playgroud)

但我遇到了:

IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
Run Code Online (Sandbox Code Playgroud)

我的 ipywidgets 是 v8.0.4,jupyter v1.0.0...tqdm 不再与 VS Code Jupyter Notebook 一起使用吗?

Kai*_*iak 6

我有同样的问题。使用这篇文章,我通过运行解决了这个问题:

%pip install --upgrade jupyter ipywidgets
%jupyter nbextension enable --py widgetsnbextension # removed !pip on the recommendation of a comment.

import time
from tqdm.notebook import tqdm
for i in tqdm(range(10)):
    time.sleep(0.1)
Run Code Online (Sandbox Code Playgroud)

  • 小事:当从笔记本内部使用“pip install”时,如果不使用感叹号,并使用添加的现代魔法命令来确保安装发生在正在使用的环境中,您将获得更好的体验通过活动笔记本底层的内核,请参阅[此处](https://discourse.jupyter.org/t/why-users-can-install-modules-from-pip-but-not-from-conda/10722/4 ?u=fomightez) 了解有关为克服感叹号缺点而添加的现代魔法命令的更多信息。您应该建议其他人在当前的 Jupyter 中也使用它。... (2认同)

yts*_*s61 6

这个小语法解决了我的问题

conda install -c conda-forge ipywidgets
Run Code Online (Sandbox Code Playgroud)

安装后请记住重新启动内核。直到我重新启动 VS Code 后它才起作用。希望能帮助到你