Jupyter Notebook 中的 tqdm 未显示

tqdm in Jupyter notebook does not show up

我想在 Jupyter notebook 中实现一个进度条。我尝试使用 tqdm,如下面的代码所示,但我只是在屏幕上显示了这个,进度条是......好吧......没有进展:

代码

# Iterate through each sound file and extract the features
from tqdm import tqdm
items = len(metadata.index)
for i in tqdm(range(items), "Completed"):
    for index, row in metadata.iterrows():
        file_name = os.path.join(os.path.abspath(fulldatasetpath),'fold'+str(row["fold"])+'/',str(row["slice_file_name"]))
    
        class_label = row["class_name"]
        data = extract_features(file_name)
    
        features.append([data, class_label])

你能帮我让进度条进步吗?谢谢!

对于 Jupyter 笔记本,您应该使用特殊版本的 tqdm:

from tqdm.notebook import tqdm