python报错:【 AttributeError module 'time' has no attribute 'clock'】

python版本: 3.8

问题:在python运行代码:

import time

print(time.clock())

 

出现错误 :      AttributeError module 'time' has no attribute 'clock'

原因        :       Python time.clock在Python3.3废弃,在Python3.8中将被移除

解决方法 :       使用perf_counter()方法

 

posted @ 2022-04-25 09:55  木子欢儿  阅读(646)  评论(0编辑  收藏  举报