python报错:type object ‘datetime.datetime’ has no attribute ‘datetime’

描述:在第一个python程序里还未报错,第二个程序完全复制过来,导入模块from datetime import datetime ,运行就报错了

原因:被2个相同的datetime给迷惑了,其实2个datetime不是在一个级别上的东西,一个是模块,一个是类。

解决办法:

1.pip3 install datetime

2.导入模块的from datetime import datetime改成import datetime

python 报错 AttributeError: type object ‘datetime.datetime‘ has no attribute ‘datetime‘相关推荐

  1. unittest-ddt报错AttributeError: type object ‘forTestDDT‘ has no attribute ‘test_2‘

    unittest 添加多个ddt数据驱动后,报错: FAILED (errors=1)Error Traceback (most recent call last):File "D:\Ana ...

  2. 解决gensim报错AttributeError: type object ‘Word2Vec‘ has no attribute ‘load_word2vec_format‘

    解决方法 将报错的 from gensim.models import Word2Vecmodel = Word2Vec.load_word2vec_format('test.bin.gz', bin ...

  3. 关于在《python编程从入门到实践》书中练习“外星人大战”报错“AttributeError: ‘AlienInvasion‘ object has no attribute ‘blit‘”

    关于在<python编程从入门到实践>书中练习"外星人大战"报错"AttributeError: 'AlienInvasion' object has no ...

  4. 生成HTML报告时,报错:AttributeError: type object ‘_io.StringIO‘ has no attribute ‘StringIO‘

    生成HTML报告时,报错:AttributeError: type object '_io.StringIO' has no attribute 'StringIO' 百度后,找到解决方法,原链接:h ...

  5. Python报错TypeError: ‘User‘ object is not iterable

    Python报错TypeError: 'User' object is not iterable 原因 User对象是不可迭代的,我这里是因为User并不是list,所以是不可迭代的,所以不使用迭代即 ...

  6. 运行项目时flask_sqlalchemy报错AttributeError: ‘LocalStack‘ object has no attribute ‘__ident_func__‘

    运行项目时flask_sqlalchemy报错AttributeError: 'LocalStack' object has no attribute '__ident_func__' 1.原因 2. ...

  7. etree.html 报错 AttributeError:‘function’ object has no attribut ‘HTML’

    etree.html 报错 1.Pycharm 中lxml没有etree模块的解决方法: 之前是: from lxml import etree tree = etree.HTML( ) python ...

  8. Python报错TypeError: 'str' object is not callable

    原文:http://blog.sina.com.cn/s/blog_71f3890901017rsh.html Python报错TypeError: 'str' object is not calla ...

  9. Scrapy爬虫报错AttributeError: ‘NoneType‘ object has no attribute ‘write‘

    前言 一.报错 AttributeError: 'NoneType' object has no attribute 'write' 二.报错原因 1.piplines文件中的方法不能自定义的呢 开始 ...

最新文章

  1. 拍拍网t恤DIY效果
  2. 暮色森林模组_我的世界暮色森林mod全攻略,尤其是Boss击杀顺序,一定要牢记...
  3. Mybatis实现多表关联多条件查询
  4. CVE-2020-0796复现(poc+exp)
  5. 使用Apache Kafka作为消息系统的发布-订阅通信中的微服务,并通过集成测试进行了验证...
  6. anaconda方法安装python教程_anaconda的安装教程和使用方法
  7. c语言第六次上机作业,C语言第五次上机作业参考答案
  8. SpringBoot整合kafka之kafka分区实战
  9. 你不可不看的 Oracle RAC 日常基本维护命令
  10. 函数03 - 零基础入门学习C语言34
  11. CentOS 6.3最小化安装后,有些必备工作才可以正常使用
  12. CSS引用外部字体的方法
  13. React小书中得CommentList的需求实现
  14. IIS管理器无法打开。启动后,在任务栏中有,但是窗口不见了
  15. SpringBoot2.0系列教程(四)Springboot框架自定义消息转换器
  16. 2021牛客寒假算法基础集训营1 C 无根树问题的处理策略 前序后序遍历 奇偶匹配 DFS
  17. ico图标概述 附生成链接
  18. eclipse的jdt简介
  19. 郸城计算机学校,郸城科技职业中等专业学校
  20. 液晶电视英文linux使用教程,【详解UbuntuTV 电视与人们的生活】PjTime.COM液晶电视 技术介绍...

热门文章

  1. 5GS 协议栈 — NR 空中接口协议栈
  2. 5GS 协议栈 — PFCP 协议 — MAR 多接入规则
  3. Linux_RHEL7_LDAP、Autofs服务
  4. O027、看nova-scheduler如何选择计算节点
  5. 关于bcp的那些事儿
  6. .gitignore无效解决方案以及git rm和rm的区别
  7. 4.Ling初体验 匿名类型在查询表达式中的使用
  8. 为什么okhttpclient不能builder
  9. Tushare的安装
  10. 解码转码---System.web.HttpUtility 对象分析