attributeError:'module' object has no attribute ** 解决办法
2015-01-23 10:38
886 查看
写了一个小脚本,执行的时候报错:
google 后说是生成的.pyc 文件的问题,删除后在运行就可以,但删除.pyc 文件运行还是报错: AttributeError: 'module' object has no attribute 'make'。
又有人说是import 的那个库.pyc 文件也要删除, 好,这次把import库的.pyc 也删除,但依据报错!
无奈改了修改了脚本的文件名,莫名其妙可以执行了,忽然想起,和import标准库命名冲突了
脚本命名为qrcode.py 要引用的库 也是qrcode
解决办法:
重命名脚本文件,不能和要引入的模块名称冲突! 不然导入不是模块而是自己创建的文件!
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 '_base' 可行解决办法
- AttributeError: 'module' object has no attribute 'SSL_ST_INIT' 解决办法
- AttributeError: 'module' object has no attribute '_base' 可行解决办法
- TRACE nova AttributeError: 'module' object has no attribute 'packs' 解决办法
- python “AttributeError: '_csv.reader' object has no attribute'next'” 报错的解决办法
- AttributeError: 'NoneType' object has no attribute 'copy' 解决办法
- python AttributeError: 'module' object has no attribute 'dumps'解决办法
- [置顶] AttributeError: 'module' object has no attribute '_base' 可行解决办法
- Keras深度学习框架学习笔记(3) - AttributeError:’module’ object has no attribute ‘ifelse’错误信息的解决方法
- Scrapy AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1 解决方法
- 解决方法——AttributeError: 'module' object has no attribute 'VideoWriter_fourcc'
- AttributeError: 'module' object has no attribute 'Spider' 解决了
- AttributeError: 'WebDriver' object has no attribute 'switchTo' 解决方法
- AttributeError: 'NoneType' object has no attribute 'execute' 错误的解决
- AttributeError: 'module' object has no attribute 的解决方法
- python 2.x和3.x关于 'module' object has no attribute 'open'的解决办法
- pylons 1.0 AttributeError: 'ContextObj' object has no attribute "xxx"
- 'NoneType' object has no attribute '__getitem__'和argument of type 'NoneType' is not iterable 异常的解决办法
- python 2.x和3.x关于 'module' object has no attribute 'open'的解决办法
- ‘dict’ object has no attribute 'has_key'解决办法