AttributeError: module ‘time‘ has no attribute ‘clock‘的解决方法

在python3.10中flask项目运行报错: AttributeError: module 'time' has no attribute 'clock'解决方案

主要原因是因为python3.10中不支持clock了, 需要替换成 time.pref_counter()

cpmpat.py文件:

if win32 or jython:
    time_func = time.clock
else:
    time_func = time.time

改为:

if win32 or jython:
    time_func = time.perf_counter()
else:
    time_func = time.time

问题解决!?


版权声明:本文为Gherbirthday0916原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。