【发布时间】:2021-05-14 22:32:35
【问题描述】:
我正在使用tqdm 来显示迭代进度。但是它在我的 jupyter notebook 环境中无法正常工作。
我可以的
from tqdm import tqdm
a = 0
for i in tqdm(range(10)):
a += i
print(a)
有输出
但是,循环中的 print 语句存在问题 (see here)。
当我这样做时
from tqdm.notebook import tqdm
a = 0
for i in tqdm(range(10)):
a += i
print(a)
我明白了
即迭代已执行,但 tqdm 不考虑它们。
知道如何解决这个问题或问题可能是什么吗?
jupyter --version 的输出是
jupyter core : 4.7.1
jupyter-notebook : 6.2.0
qtconsole : not installed
ipython : 7.20.0
ipykernel : 5.1.0
jupyter client : 6.1.11
jupyter lab : not installed
nbconvert : 5.6.1
ipywidgets : 7.6.3
nbformat : 5.1.2
traitlets : 5.0.5
编辑 这个问题似乎与 MacOS 相关(我运行的是 10.15.7),因为我在 CentOS 上没有观察到它。
除了我尝试过之外,我还更新了我的 conda 环境
jupyter core : 4.7.1
jupyter-notebook : 6.2.0
qtconsole : 5.0.2
ipython : 7.20.0
ipykernel : 5.5.0
jupyter client : 6.1.11
jupyter lab : not installed
nbconvert : 6.0.7
ipywidgets : 7.6.3
nbformat : 5.1.2
traitlets : 5.0.5
在 python 3.8.8 上。 (我也在 3.7.10 上试过)。
This issue 讨论了类似的问题,问题似乎与 ipywidgets 有关。
【问题讨论】:
-
我在这里打开了一个问题:github.com/tqdm/tqdm/issues/1149
标签: python jupyter-notebook tqdm