Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
来源:互联网 发布:java empty array 编辑:程序博客网 时间:2024/05/18 09:03
最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attribute 'xxx'"。这其实是.pyc文件存在问题。
问题定位:
查看import库的源文件,发现源文件存在且没有错误,同时存在源文件的.pyc文件
问题解决方法:
1. 命名py脚本时,不要与python预留字,模块名等相同
2. 删除该库的.pyc文件(因为py脚本每次运行时均会生成.pyc文件;在已经生成.pyc文件的情况下,若代码不更新,运行时依旧会走pyc,所以要删除.pyc文件),重新运行代码;或者找一个可以运行代码的环境,拷贝替换当前机器的.pyc文件即可
阅读全文
0 0
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- 【python学习笔记(2)】脚本报错"AttributeError: 'module' object has no attribute 'xxx'"解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’
- 【Python 脚本报错】AttributeError:'module' has no attribute 'xxx'的解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’get’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute ’urllibopen'(Python 2.7.11 )
- AttributeError: 'module' object has no attribute 'XXX'
- 项目总结
- UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multibyte sequence
- Redis系列三
- 数据结构上机2——链表
- SSM框架——使用MyBatis Generator自动创建代码
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- GameEntity(三)—— EntityStrategyHelper
- 如何在Web页面里使用高拍仪扫描上传图像
- Linux 环境下tomcat 开机启动设置
- Spring Boot打包war jar 部署tomcat
- win10下caffe+gpu使用问题总结
- 64位Windows10下python + theano + keras安装
- 2017中国共享信用平台火爆 广东问果科技 成功造佳绩
- 异步工作 boost asio