写了一个小脚本,执行的时候报错:

 Traceback (most recent call last):
File "F:/test/qrcode.py", line 109, in generateQr
img = qrcode.make(textcontent)
AttributeError: 'module' object has no attribute 'make'

google 后说是生成的.pyc 文件的问题,删除后在运行就可以,但删除.pyc 文件运行还是报错: AttributeError: 'module' object has no attribute 'make'。

又有人说是import 的那个库.pyc 文件也要删除, 好,这次把import库的.pyc 也删除,但依据报错!

无奈改了修改了脚本的文件名,莫名其妙可以执行了,忽然想起,和import标准库命名冲突了

脚本命名为qrcode.py   要引用的库 也是qrcode

解决办法:

重命名脚本文件,不能和要引入的模块名称冲突! 不然导入不是模块而是自己创建的文件!

attributeError:'module' object has no attribute ** 解决办法的更多相关文章

  1. 解决:pipenv shell报错:AttributeError: 'module' object has no attribute 'run'

    利用pipenv shell切换到虚拟环境时,显示报错:AttributeError: 'module' object has no attribute 'run' 可以看到是d:\program\p ...

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

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

  3. 提示AttributeError: 'module' object has no attribute 'HTTPSHandler'解决方法

    今天在新机器上安装sqlmap,运行提示AttributeError: 'module' object has no attribute 'HTTPSHandler' 网上找了找资料,发现一篇文章ht ...

  4. AttributeError: 'module' object has no attribute 'TornadoAsyncNotifier'

    /*************************************************************************** * AttributeError: 'modu ...

  5. AttributeError: 'module' object has no attribute 'X509_up_ref'

    主要报错: AttributeError: 'module' object has no attribute 'X509_up_ref' 1 解决办法 卸载再重装pyOpenSSL pip unins ...

  6. 【Python】【亲测好用】安装第三方包报错:AttributeError:'module' object has no attribute 'main'

    安装/卸载第三包可能出现如下问题及相应解决办法: 在pycharm编辑中,使用anconda2更新.卸载第三方包时,出现如下错误: AttributeError:'module' object has ...

  7. 安装pandas报错(AttributeError: 'module' object has no attribute 'main')

    在pycharm中安装pandas出现报错:AttributeError: 'module' object has no attribute 'main', 刚开始以为是pip的版本太旧了,于是乎将其 ...

  8. python问题:AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

    AttributeError: 'module' object has no attribute 'SSL_ST_INIT' 问题背景: 下载工具wydomain,安装依赖包以后,出现下图问题. 几经 ...

  9. AttributeError: 'module' object has no attribute 'main'

    本机环境:ubuntu16.04,  ros-kinetic $ roscore 报错 Traceback (most recent call last): File , in <module& ...

随机推荐

  1. PYTHON 自动化之路 (二)

    一.python 模块的使用 模块的使用: import os #调用 os 模块 cmd_s = os.popen("dir").read() #打开路径为结果保存为cmd_sp ...

  2. 阻止a标签默认跳转事件

    1:<a href="####"></a> 2:<a href="javascript:void(0)"></a> ...

  3. php过滤ascii控制字符

    还记得以前在工作中,将爬来的其它网站的数据导到xml.但是会遇到一个问题:即网页会有ascII的控制字符. 一开始以为是别人为了防止采集而加入的,然后发现一个就往过滤表里加一个.直到慢慢发现,他们都是 ...

  4. [转]Unchecked Exception 和 Checked Exception 比较

    Throwable类是所有异常的始祖,它有两个直接子类Error / Exception:   Error仅在Java虚拟机中发生动态连接失败或其它的定位失败的时候抛出一个Error对象.一般程序不用 ...

  5. android课件和源代码

    ppt.rar 代码.rar 也可以自己从这里下载http://pan.baidu.com/share/link?shareid=1287391506&uk=2634355140

  6. Zookeeper集群服务部署

    Zookeeper是一个分布式.开源的分布式应用程序协调服务,是Google的Chubby的开源实现,也是和Hadoop.Hbase相互配合的重要组件,作用就是为分布式应用程序提供一致性服务,包括配置 ...

  7. perl运行其他程序的5种方法

    1.使用system函数 运行成功,返回0,运行失败则返回非负整数 system("cmd"); 2.使用qx my $cmd1=qx/date/; 3.使用`` 与qx等效 4. ...

  8. ACM/ICPC 之 DFS求解欧拉通路路径(POJ2337)

    判断是欧拉通路后,DFS简单剪枝求解字典序最小的欧拉通路路径 //Time:16Ms Memory:228K #include<iostream> #include<cstring& ...

  9. Android Shape自定义纯色圆角按钮

    版权声明:分享技术,传播快乐.如果本博客对你有帮助,请在我的博客首页为我打赏吧! 在Android开发中,为响应美化应用中控件的效果,使用Shape定义图形效果,可以解决图片过多的问题. 首先看一下效 ...

  10. 【leetcode】Maximum Gap(hard)★

    Given an unsorted array, find the maximum difference between the successive elements in its sorted f ...