加载时的Python进度栏

我正在使用面部识别程序,执行该程序后,需要几秒钟才能打印出来。在那几秒钟的python加载期间,是否可以显示百分比加载栏?

在python执行和加载时,将显示1%,然后显示2%,但是在同一行上,2代替了1%。

如果您不清楚,我将提供一些简单的意见来帮助您进行交流。

面部识别代码:

import face_recognition
picture_of_me = face_recognition.load_image_file("me.jpg")
my_face_encoding = face_recognition.face_encodings(picture_of_me)[0]
unknown_picture = face_recognition.load_image_file("unknown.jpg")
unknown_face_encoding = face_recognition.face_encodings(unknown_picture)[0]
results = face_recognition.compare_faces([my_face_encoding], unknown_face_encoding)
if results[0] == True:
    print("FRS successful: Match found")
else:
    print("FRS unsuccessful")
评论
  • 爱旳偏执
    爱旳偏执 回复

    I am not familiar with the face_recognition module so It will take me time to write a complete answer, but did you consider using TQDM?