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 ...
随机推荐
- java-接口和抽象类的联系和区别。
接口和抽象类的联系和区别. 一,简单总结 1.抽象类和接口都不能直接实例化,如果要实例化,抽象类变量必须指向实现所有抽象方法的子类对象,接口变量必须指向实现所有接口方法的类对象. 2.抽象类要被子类继 ...
- 通过编写聊天程序来熟悉python中多线程及socket的用法
1.引言 Python中提供了丰富的开源库,方便开发者快速就搭建好自己所需要的应用程序.本文通过编写基于tcp/ip协议的通信程序来熟悉python中socket以及多线程的使用. 2.python中 ...
- hello Groovy
Groovy [rocky@www ~]$ curl -s get.sdkman.io 1. 下载 [rocky@www Downloads]$ wget https://dl.bintray.com ...
- css的元素表现
块级元素和行内元素的表现: 块级元素:块级元素和父元素的宽度一致,默认情况下就是和body的宽度一样,也可以说和浏览器窗口的宽度一致,致使同一行不能再放下另外的元素,所以块级元素表现为独占一行. 块级 ...
- 以local模式使用Xshell+Xmanager远程监控jvisualvm
使用jvisualvm的remote方式监控服务器端jvisualvm时,不是很方便,因此通过local方式,应该是正路. 一.服务器端(Linux,最小安装模式,没有图形界面) 1.安装xauth ...
- Pig模式
Pig中的模式可以是用户显示声明的,也可以是Pig通过用户的使用方式猜测的. Pig对模式的认知在Pig Latin脚本执行的不同阶段可能是不同的. 下面的语句,用户显示声明了模式:3个字段, ...
- mybatis 在存储Integer、bigdecimal等java数据类型时,将0存成null
我们的项目中,有关于金额的计算,所以,一般在java环境中我们使用bigdecimal来做运算和存储金额信息.数据库sqlServer2008用的float类型 问题是,当我将金额赋值成0时,很意外的 ...
- springboot学习入门之三---启动原理
3启动原理 3.1启动类 @SpringBootApplication public class Application { public static void main(String[] args ...
- BackgroundWorker原理剖析
BackgroundWorker类位于System.ComponentModel命名空间下,主要用来异步执行一个长时间的操作,然后,在完成事件中安全更新UI的控件属性.UI中的控件是不允许非创建该控件 ...
- teradata 字符串数据合并 在concat()函数无法使用的情况下
在teradata sql中不存在concat()函数或者stuff()函数,在此情况下,如何实现多条字符串数据合并成一行? 在查找不同方法过程中,在stackflow中找到最简便的方法,使用xml_ ...