You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code Jupyter Notebook中tqdm报错:IProgress未找到

解决VS Code Jupyter Notebook中tqdm.notebook的IProgress报错问题

你的情况不是tqdm在VS Code Jupyter Notebook中无法使用,而是ipywidgets 8.x版本与tqdm.notebook的适配需要调整配置,以下是具体解决方法:

方法一:修复ipywidgets与tqdm的适配配置

  1. 升级tqdm到兼容版本:
    在终端执行:
    pip install --upgrade tqdm
    
  2. 启用ipywidgets的Jupyter扩展支持:
    执行以下命令:
    jupyter nbextension enable --py widgetsnbextension
    jupyter serverextension enable --py widgetsnbextension
    
  3. 重启VS Code,重新打开Jupyter Notebook再运行脚本。

方法二:改用文本版tqdm(快速替代方案)

如果不想折腾配置,可以直接替换导入语句,使用非交互式的文本进度条,同样能正常工作:

from tqdm import tqdm
import time
for i in tqdm(range(10)):
    time.sleep(1)

注意:你原来的代码里缺少import time,运行时还会报time未定义的错误,记得补上。

内容的提问来源于stack exchange,提问作者liamhp

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.01 15:20:24