运行python程序时,也许会出现这样的错误:AttributeError: module ‘xxx’ has no attribute ‘xxx’: 
解决该错误有两种方法

1、手动安装该模块

2、检查文件名

这个方式看起来很傻,但是却是新手经常会犯的错,原因是因为自己的文件名称和要使用的模块重名了,只需要更改文件名即可。

 

python出现AttributeError: module ‘xxx’ has no attribute ‘xxx’错误时,两个解决办法的更多相关文章

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

    最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...

  2. python 提示 AttributeError: module 'json' has no attribute 'dumps'

    最近在学习python解析json的时候遇到问题, 提示 AttributeError: module 'json' has no attribute 'dumps' (模块没有dumps属性的意思) ...

  3. 【Python 脚本报错】AttributeError: 'module 'yyy' has no attribute 'xxx'的解决方法

    先参考这篇记录大概理解了原因, 再深入了解下python的import机制, 发现自己的模块之间存在互相import. 比如,A.py中import B,而B.py中也import A了, 现在执行模 ...

  4. 运行pytest,报错"AttributeError: 'module' object has no attribute 'xxx'"

    最近学习pytest被此问题困扰,敲脑壳,实在是不该.百度解决方法一大堆,我的问题怎么也解决不了,来看一下,我是怎么解决的,各位大佬勿喷,只是自己做笔记用,谢谢. 报错信息如下: 网上解决方法是这样的 ...

  5. python 脚本运行时报错: AttributeError: 'module' object has no attribute ***

    最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...

  6. 在运行create_list.sh时候报错:AttributeError: 'module' object has no attribute 'LabelMap'

    Traceback (most recent call last):File "/opt/xuben-project/caffe/data/VOC0712/../../scripts/cre ...

  7. Python AttributeError: 'Module' object has no attribute 'STARTF_USESHOWINDOW'

    夫学须志也,才须学也,非学无以广才,非志无以成学.--诸葛亮 生活有度,自得慈铭 --杜锦阳 今天新来的同事安装环境遇到个莫名其妙的问题: AttributeError: 'Module' objec ...

  8. python中提取位图信息(AttributeError: module 'struct' has no attribute 'unstack')

    前言 今天这篇博文有点意思,它是从一个例子出发,从而体现出在编程中的种种细节和一些知识点的运用.和从前一样,我是人,离成神还有几十万里,所以无可避免的出现不严谨的地方甚至错误,请酌情阅读. 0x00 ...

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

    python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...

随机推荐

  1. 关于Java HotSpot(TM) 64-Bit Server VM warning: Insufficient space for shared memory file: 11043的解决办

    Java HotSpot(TM) 64-Bit Server VM warning: Insufficient space for shared memory file: /tmp/hsperfdat ...

  2. 外星人电脑出现the system is running in low graphics mode的解决方法

    问题现象: 执行删除GCC5.4.0: sudo  apt-get remove gcc gcc-5重启电脑后,就显示the system is running in low graphics mod ...

  3. Linux SUID SGID SBIT 简介和权限设定

    SUID :Set UID 1 SUID 权限仅对二进制程序(binary program)有效 2 执行者对于该程序需要具有x的可执行权限 3 本权限仅在执行该程序的过程中有效(run-time) ...

  4. Android单元测试之google官例CalculatorTest

    执行测试用例类CalculatorTest     设置genymotion可见: Android Studio界面中,依次单击菜单项 View >Toolbar.即可见改工具按钮. 启动gen ...

  5. ubuntu下安装tensorflow-gpu版本过程

    我之前已经安装了cpu-only版的tensorflow,所以现在要先把原先的tf卸载 sudo pip uninstall tensorflow sudo pip3 install tensorfl ...

  6. 多线程(二)Object类方法、线程的操作sleep(),join(),interrupt(),yield()

    四.Object类简介 Object类是所有类的超类,之所以放在线程部分是因为其方法很多是和线程有关的.比如以下三个: wait()方法.wait(long timeout)和wait(long ti ...

  7. DevExpress ASP.NET Bootstrap v19.1版本亮点:Scheduler控件

    行业领先的.NET界面控件DevExpress 正式发布了v19.1版本,本文将以系列文章的方式为大家介绍DevExpress ASP.NET Bootstrap Controls中Rich Text ...

  8. k8spod生命周期

    pod对象自从创建开始至终止退出的时间范围称为生命周期,在这段时间中,pod会处于多种不同的状态,并执行一些操作:其中,创建主容器为必须的操作,其他可选的操作还包括运行初始化容器(init conta ...

  9. cmd 端口占用

    netstat -ano|findstr 1080 taskkill /pid 3188 /f

  10. puppet使用rsync模块同步目录和文件

    puppet使用rsync模块同步目录和文件 2013-09-23 14:28:57 分类: LINUX 环境说明: OS :    CentOS5.4                         ...