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

 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. Linux system 函数的一些注意事项

    在日常的代码编程中 , 我们可以利用system  函数去调用一些我们自己想调用的命令 , 并获取他的返回值. 函数的原型如下: int system(const char *command); 上一 ...

  2. BZOJ 2448: 挖油

    Description [0,x]中全是1,其余全是0,每个点有一个权值,求最坏情况下得到x的最小权值. Sol DP+单调队列. 首先就是一个 \(O(n^3)\) 的DP. \(f[i][j]\) ...

  3. List转换DataTable

    /// <summary> /// 将泛类型集合List类转换成DataTable /// </summary> /// <param name="list&q ...

  4. C#函数参数

    当函数接受参数时,必须指定下属内容 函数在其定义中指定参数列表,以及这些参数的类型 在每个函数调用中匹配参数列表 参数匹配:当调用函数时,必须使参数与函数定义中指定的参数完全匹配,这意味着要匹配参数的 ...

  5. HTML——选择器

    在前面的章节中,我们展示了一些有关如何选取 HTML 元素的实例. 关键点是学习 jQuery 选择器是如何准确地选取您希望应用效果的元素. jQuery 元素选择器和属性选择器允许您通过标签名.属性 ...

  6. split() 注意事项.

    split(): 当函数默认为空,它会把所有空格(空格符.制表符.换行符)当作分隔符. 但是当函数参数默认为其他,将会对 空格符.制表符.换行符 当作元素进行分割. a = 'hello world! ...

  7. 【leetcode】Search in Rotated Sorted Array II

    Search in Rotated Sorted Array II Follow up for "Search in Rotated Sorted Array":What if d ...

  8. ios NSURLSession completeHandler默认调用quque

    注意 , [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *data, NSU ...

  9. FFMpeg ver 20160219-git-98a0053 滤镜中英文对照 2016.02.21 by 1CM

    FFMpeg ver 20160219-git-98a0053 滤镜中英文对照 2016.02.21 by 1CM T.. = Timeline support 支持时间轴 .S. = Slice t ...

  10. shiro错误总结

    今天在做spring+mybatis+springmvc+shiro的时候,报这个错,刚开始以为是shiro登录验证出错,后来,观看一下错误,发现在别的xml中写错了代码,shiro接连着报错,记录一 ...