Cannot import name simplejson - After installing simplejson

后端 未结 1 1057
别跟我提以往
别跟我提以往 2020-12-03 21:54

I have Django Version 1.7 and Python Version 2.7.5 - I used pip install simplejson and apt-get install python-simplejson commands to solve this problem but it still shows m

相关标签:
1条回答
  • 2020-12-03 22:20

    Your code isn't compatible with the version of Django you are using.

    Django used to ship with simplejson in django.utils, but this was removed in Django 1.5:

    django.utils.simplejson

    Since Django 1.5 drops support for Python 2.5, we can now rely on the json module being available in Python’s standard library, so we’ve removed our own copy of simplejson. You should now import json instead of django.utils.simplejson.

    Unfortunately, this change might have unwanted side-effects, because of incompatibilities between versions of simplejson – see the backwards-incompatible changes section. If you rely on features added to simplejson after it became Python’s json, you should import simplejson explicitly.


    You should update the code in extdirect's providers.py to import json instead, or use the version of Django it was designed to work with.

    0 讨论(0)
提交回复
热议问题