import json后,报错:AttributeError: 'module' object has no attribute 'dumps,原因分析及解决方法
来源:互联网 发布:金融大数据概念股 编辑:程序博客网 时间:2024/06/05 10:38
编写python代码,import json后,报错:AttributeError: 'module' object has no attribute 'dumps',如下图所示:
报错信息为:模块没有方法dumps
单步调试:
单步调试,发现报错相同。
查看json模块的方法
由上图可知,json.py路径并不是python库下的,因此没有dumps的方法。
查看环境变量,首先查询当前目录,然后搜索不到,才查找C:\\Python27\\lib\\site-packages;
进入D:\__python_code目录查看,果真有json.py,和python 库中的json.py冲突.
删除D:\__python_code目录下的json.py,再运行上述脚本就OK 了;
总结报错原因:除C:\\Python27\\lib\\site-packages外,存在其他目录下存在json.py,import json后,调用json的很多方法就报错。
0 0
- import json后,报错:AttributeError: 'module' object has no attribute 'dumps,原因分析及解决方法
- python3.6脚本import json模块后,报错:AttributeError: module 'json' has no attribute 'dumps'
- import module报错AttributeError: 'module' object has no attribute
- AttributeError: module 'json' has no attribute 'dumps'
- python AttributeError: 'module' object has no attribute 'dumps'解决办法
- python 错误解析 AttributeError: 'module' object has no attribute 'dumps'
- python3 报错: AttributeError: 'module' object has no attribute 'urlopen'
- 报错AttributeError: 'module' object has no attribute 'HTTPSConnection'
- 报错 AttributeError: 'module' object has no attribute 'bool_'
- Tensorflow报错:AttributeError: 'module' object has no attribute 'summary'
- 【Tensorflow】报错:AttributeError: 'module' object has no attribute 'scalar_summary'
- Tensorflow报错:AttributeError: 'module' object has no attribute 'scalar_summary'
- pandas报错AttributeError: 'module' object has no attribute 'plotting'
- tensorflow报错:AttributeError: 'module' object has no attribute 'get_or_create_global_step'
- 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’解决方法
- 性能测试方法(策略)
- SVM入门(九)松弛变量(续)
- Fragment常见错误(state丢失)
- Android4.4中WebView无法显示图片解决方案
- linux进程通信--信号量
- import json后,报错:AttributeError: 'module' object has no attribute 'dumps,原因分析及解决方法
- 基于opencv的场景文字识别
- SOA研究(1)-从NIO开始
- python 练习记忆
- 菜鸟的安卓之路。2016.05.31
- 配置PL-SQLDeveloper
- zookeeper 原理
- 如何衡量测试效率
- linux修改用户名