jupyter报错:NameError: name 'tqdm' is not defined


NameError                                 Traceback (most recent call last)
input-3-b0b90df99ac7> in 
      1 drug_emb, all_labels = plot_drug_embeddings(config_file="training_after_round_5_successive_rounds", 
----> 2              path_to_conf="/Users/paul/PycharmProjects/RECOVERcoalition/Recover/RayLogs/")

input-2-843585463136> in plot_drug_embeddings(config_file, path_to_conf)
     75     cpt = 0
     76 
---> 77     for trainer in trainer_iterator(config_file, path_to_conf):
     78 
     79         cpt += 1

input-2-843585463136> in trainer_iterator(config_file, path_to_conf)
      7 
      8     # Loop over all runs for this configuration
----> 9     for run_dir in tqdm(os.listdir(os.path.join(path_to_conf, config_file))):
     10         print(run_dir)
     11         if run_dir.startswith('BasicTrainer'):

NameError: name 'tqdm' is not defined

已经重新pip过tqdm了,但是没有用,imoprt的时候是没有报错的,请问各位要如何解决?

这个报错是因为在代码中使用了tqdm这个库,但是没有正确导入。需要在代码中加上from tqdm import tqdm的语句来导入该库。具体可以参考