问题产生原因:

  • python的版本过低,其中的json包年久失修,需要更新

解决方法:

  1. 删除就的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的解决方法的更多相关文章

  1. PyQt程序执行时报错:AttributeError: 'winTest' object has no attribute 'setCentralWidget'的解决方法

    用QtDesigner设计了一个UI界面,保存在文件Ui_wintest.ui中,界面中使用了MainWindow窗口,窗口名字也叫MainWindow,用PyUIC将其转换成了 Ui_wintest ...

  2. 【Python 脚本报错】AttributeError: 'module 'yyy' has no attribute 'xxx'的解决方法

    先参考这篇记录大概理解了原因, 再深入了解下python的import机制, 发现自己的模块之间存在互相import. 比如,A.py中import B,而B.py中也import A了, 现在执行模 ...

  3. 'Settings' object has no attribute 'TEMPLATE_DEBUG' 的解决方法

    找到该Django项目下的settings文件,把 DEBUG = True 改为 DEBUG = False 就可以正常浏览显示了 参考:https://stackoverflow.com/ques ...

  4. AttributeError: 'module' object has no attribute 'X509_up_ref'

    主要报错: AttributeError: 'module' object has no attribute 'X509_up_ref' 1 解决办法 卸载再重装pyOpenSSL pip unins ...

  5. attributeError:'module' object has no attribute ** 解决办法

    写了一个小脚本,执行的时候报错: Traceback (most recent call last): File "F:/test/qrcode.py", line 109, in ...

  6. 解决:pipenv shell报错:AttributeError: 'module' object has no attribute 'run'

    利用pipenv shell切换到虚拟环境时,显示报错:AttributeError: 'module' object has no attribute 'run' 可以看到是d:\program\p ...

  7. Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法

    最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...

  8. 'module' object has no attribute 'Thread'解决方法及模块加载顺序

    源码片段: class myThread(threading.Thread): def __init__(self, threadID, name, counter): threading.Threa ...

  9. 提示AttributeError: 'module' object has no attribute 'HTTPSHandler'解决方法

    今天在新机器上安装sqlmap,运行提示AttributeError: 'module' object has no attribute 'HTTPSHandler' 网上找了找资料,发现一篇文章ht ...

随机推荐

  1. Code Signal_练习题_Make Array Consecutive2

    Description Ratiorg got statues of different sizes as a present from CodeMaster for his birthday, ea ...

  2. Django基础六之ORM中的锁和事务

    一 锁 行级锁 select_for_update(nowait=False, skip_locked=False) #注意必须用在事务里面,至于如何开启事务,我们看下面的事务一节. 返回一个锁住行直 ...

  3. ARCGIS知乎上的好文章

    http://zhihu.esrichina.com.cn/?/feature/ArcGISAndroidDevNote ArcGIS知乎上有哪些干货可以推荐? http://zhihu.esrich ...

  4. iOS上Delegate的悬垂指针问题

    文章有点长,写的过程很有收获,但读的过程不一定有收获,慎入 [摘要]   悬垂指针(dangling pointer)引起的crash问题,是我们在iOS开发过程当中经常会遇到的.其中由delegat ...

  5. 记一次Android studio升级之后的坑

    像往常一样打开Android studio,但这次它提示我升级!说是什么为了更好的体验,在好奇心的驱使下,我毅然地点击了“update”按钮.升级之后,编译项目,报出了N多个error,我的心都慌完! ...

  6. Jupyter notebook 使用多个Conda 环境

    conda install nb_conda_kernels

  7. JSON学习笔记-5

    JSON.parse() 1.从服务器接受数据进行解析(一般是字符串) 2.解析前要确保你的数据是标准的 JSON 格式,否则会解析出错.可以使用线工具检测:https://c.runoob.com/ ...

  8. shell黑名单

    #/bin/bash netstat -ant | " | awk '{print $5}' | grep -v "^10" | cut -d ":" ...

  9. 【Java】多线程

    class RunnableDemo implements Runnable { private Thread t; private String threadName; RunnableDemo( ...

  10. 手动配置wnmp环境

    wamp 是什么? windows,nginx,mysql,php(当然也可以是PYTHON等) 只所以使用nginx,是因为我等下要配置ZendGuardLoader ZendGuardLoader ...