module object has no attribute dumps的解决方法
问题产生原因:
- python的版本过低,其中的json包年久失修,需要更新
解决方法:
- 删除就的json包
>>> import json
>>> print json.__file__
/home/areynolds/opt/lib/python2.5/site-packages/json.pyc
rm 上面的文件
如果是2.7直接删除完json目录
2.重新安装simplejson
wget https://pypi.python.org/packages/08/48/c97b668d6da7d7bebe7ea1817a6f76394b0ec959cb04214ca833c34359df/simplejson-3.11.1.tar.gz#md5=6e2f1bd5fb0a926facf5d89d217a7183
tar -zxvf simplejson-3.11.1.tar.gz
cd simplejson-3.11.1
pyhon setup.py install
- 测试
[root@ice02 simplejson-3.11.1]# python
Python 2.7.2 (default, May 8 2017, 13:21:47)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import simplejson as json
>>> a = {"yu":"so"}
>>> a1 = json.dumps(a)
>>> print a1
{"yu": "so"}
>>> print type(a1)
<type 'str'>
module object has no attribute dumps的解决方法的更多相关文章
- PyQt程序执行时报错:AttributeError: 'winTest' object has no attribute 'setCentralWidget'的解决方法
用QtDesigner设计了一个UI界面,保存在文件Ui_wintest.ui中,界面中使用了MainWindow窗口,窗口名字也叫MainWindow,用PyUIC将其转换成了 Ui_wintest ...
- 【Python 脚本报错】AttributeError: 'module 'yyy' has no attribute 'xxx'的解决方法
先参考这篇记录大概理解了原因, 再深入了解下python的import机制, 发现自己的模块之间存在互相import. 比如,A.py中import B,而B.py中也import A了, 现在执行模 ...
- 'Settings' object has no attribute 'TEMPLATE_DEBUG' 的解决方法
找到该Django项目下的settings文件,把 DEBUG = True 改为 DEBUG = False 就可以正常浏览显示了 参考:https://stackoverflow.com/ques ...
- AttributeError: 'module' object has no attribute 'X509_up_ref'
主要报错: AttributeError: 'module' object has no attribute 'X509_up_ref' 1 解决办法 卸载再重装pyOpenSSL pip unins ...
- attributeError:'module' object has no attribute ** 解决办法
写了一个小脚本,执行的时候报错: Traceback (most recent call last): File "F:/test/qrcode.py", line 109, in ...
- 解决:pipenv shell报错:AttributeError: 'module' object has no attribute 'run'
利用pipenv shell切换到虚拟环境时,显示报错:AttributeError: 'module' object has no attribute 'run' 可以看到是d:\program\p ...
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...
- 'module' object has no attribute 'Thread'解决方法及模块加载顺序
源码片段: class myThread(threading.Thread): def __init__(self, threadID, name, counter): threading.Threa ...
- 提示AttributeError: 'module' object has no attribute 'HTTPSHandler'解决方法
今天在新机器上安装sqlmap,运行提示AttributeError: 'module' object has no attribute 'HTTPSHandler' 网上找了找资料,发现一篇文章ht ...
随机推荐
- Vue.js 的一些小技巧
给 props 属性设置多个类型 这个技巧在开发组件的时候用的较多,为了更大的容错性考虑,同时代码也更加人性化: export default { props: { width: { type: [S ...
- jquery3.0移除了.load()方法
参考链接:新版jquery去掉load事件了吗? 今天也遇到了这个问题,查了一下文档,确实从3.0开始移除了load.unload.error事件方法.不过依然可以用on方法绑定这些事件. Break ...
- 葡萄城报表介绍:Java 报表
一.Java 报表定义 Java 是一门面向对象编程语言,不仅吸收了 C++ 语言的各种优点,还摒弃了 C++ 里难以理解的多继承.指针等概念,因此 Java 语言具有功能强大和简单易用两个特征.Ja ...
- springboot 针对jackson是自动化配置
spring.jackson.date-format指定日期格式,比如yyyy-MM-dd HH:mm:ss,或者具体的格式化类的全限定名 spring.jackson.deserialization ...
- 铁乐学python_shelve模块详解
python序列化模块-shelve模块详解 shelve:vt. 将(书等)放置在架子上:搁置,将某事放到一旁不予考虑:将-搁在一边:装搁架于: 个人感觉有点像字典缓存?暂时搁置到一旁的意思? 研究 ...
- (转)Matlab矩阵的简单操作
转自:http://blog.sina.com.cn/s/blog_6264e23a0100veeq.html
- September 29th 2017 Week 39th Friday
Human life is ephemera, which makes it precious. 生命短暂,所以珍贵. Don't waste time on praying to the God. ...
- wrap装饰器包
import wrapt # without argument in decorator @wrapt.decorator def logging(wrapped, instance, args, k ...
- 打开文件 和 字符串中%s 的大坑
ai`....
- Log4net 使用之 日期字段格式化
Log4net 是.Net下一个非常优秀的开源日志记录组件.log4net记录日志的功能非常强大.它可以将日志分不同的等级,以不同的格式,输出到不同的媒介. 之前Log4net的日期字段Data一直采 ...