源码如下:

#引入所需要的时间库
import datetime
import time#程序计时器,启动计时器
start = time.clock()#中间是放置需要测试运行时间的程序代码#计算启动时间和结束时间的时间差
end = time.clock()
print('运行时间 : %s 秒'%(end-start))

报错 AttributeError module 'time' has no attribute 'clock'

解决方法:python3.8不支持 clock 了,用 time.perf_counter() 替换就可以了

python 报错 AttributeError: module ‘time‘ has no attribute ‘clock 解决方法相关推荐

  1. python中引入包的时候报错AttributeError: module ‘sys‘ has no attribute ‘setdefaultencoding‘解决方法?

    python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法? 参考文章: (1)pyth ...

  2. python导入自定义模块报attributeerror_Python脚本报错AttributeError: ‘module’ src has no attribute’xxx’解决方法...

    在跑论文源码时报出的错误,其中"src"是源码中的一个文件夹,同时是一个包(因为有_init_.py文件)整个项目文件组织如下: 出错的py文件在utils文件夹下,追踪定位出错代 ...

  3. Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法

    解决方法:xx.py文件名时,xx不要是python保留字 原理:因为使用了Python系统库的名字,所以在编译的时候才会产生.pyc文件. 正常的Python文件在编译运行的时候是不会产生.pyc文 ...

  4. Python脚本报错AttributeError: ‘module’ object has no attribute’get’解决方法

    发现代码都没有错.后来是改成这样: def pprint():name=var.get()print(name) var=StringVar() Label(root,text='姓名:',font= ...

  5. 学习python-mysql:报错AttributeError: module 'MySQLdb' has no attribute 'cursors'

    爬虫写入数据库时报错: AttributeError: module 'MySQLdb' has no attribute 'cursors' 解决方法: 引入 import MySQLdb.curs ...

  6. 第一:Python+Allure运行报错AttributeError: module ‘allure‘ has no attribute ‘severity_level‘

    1.很多查询结果都是先卸载pytest-allure-adaptor,然后再安装allure-pytest pip3 uninstall pytest-allure-adaptor 2.pip3 in ...

  7. python报错AttributeError module ‘scipy.misc‘ has no attribute ‘imresize‘和 ‘imread‘

    python报错AttributeError: module 'scipy.misc' has no attribute 'imresize'和 'imread' 报错原因:scipy版本过高 解决方 ...

  8. pyinstall :打包 .exe 文件报错AttributeError: module ‘enum‘ has no attribute ‘IntFlag‘

    有疑问的地方 参考博文 一.环境搭建 Python GUI图形化小工具编程学习-- PySide2 环境搭建(一) 二.实例演示 Python GUI图形化小工具编程学习-- Demo 实例演示(二) ...

  9. 【pycharm】pycharm上安装tensorflow,报错:AttributeError: module ‘pip‘ has no attribute ‘main‘ 解决方法

    [pycharm]pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法 参考文章: (1) ...

最新文章

  1. BCE或能成为BCH的一个侧链
  2. 创建程序集时元数据失败 -- 拒绝访问_kubectl 创建 Pod 背后到底发生了什么?
  3. DNS视图及日志系统
  4. 密码学常用的算法填充模式_密码学的操作模式
  5. mysql字符集解释_MySQL字符集详解
  6. python中函数包括标准库函数吗_Python标准库:内置函数divmod(a, b)
  7. 密码学小知识(1):布隆过滤器(Bloom Filter)、混淆布隆过滤器(Garbled BF)和布谷鸟过滤器(Cuckoo Filter)
  8. 音视频-Video标签整理(属性、方法、事件)
  9. 虚拟vpc服务器搭建,服务器搭建vpc
  10. xftp、xshell安装出现1603错误解决,亲测有用
  11. [Excel函数] COUNT函数 | COUNTIF函数 | COUNTIFS函数
  12. 室内定位技术方案---Wifi、RFID、bluetooth、Zigbee
  13. 哪个省才是高考地狱模式?有你的省吗?
  14. LQ0018 顺子日期【枚举+日期】
  15. 初探微信小游戏(一)
  16. 原生js获取html元素属性,JS(原生js和jq方式)获取元素属性(自定义属性),删除属性(自定义属性)...
  17. 基于微信小程序的点餐系统 报告+任务书+开题报告+中期报告+中期PPT+项目源码(Java+MySQL)及数据库文件
  18. 我的世界1.14刷雪机java版_我的世界全自动刷雪机图文攻略
  19. 京东万象行驶证识别api
  20. 021-C++中野指针

热门文章

  1. 4安装-企业级 Hyper-v 群集部署实验方案
  2. 去掉微软认证的WINDOWS盗版标志
  3. Tungsten Fabric SDN — Netronome Agilio SmartNIC vRouter
  4. 5G NGC — UE 的二次鉴权(Secondary Authentication)方案
  5. OpenFlow Switch —— 软件架构
  6. C 语言编程 — 输入/输出与文件操作
  7. 统计与分布之高斯分布
  8. Openstack组建部署 — Glance Install
  9. STM32启动文件分析
  10. ie6下js更新元素display:block后,仍然不显示的hack办法