ImportError: 无法导入名称 simplejson。我正在使用 django v1.8 和 django-Select2 v4.3.1
·
问题:ImportError: 无法导入名称 simplejson。我正在使用 django v1.8 和 django-Select2 v4.3.1
我的错误(命令 python manage.py runserver)-文件“/Users/username/virtual-env/lib/python2.7/site-packages/jsonfield/fields.py”,第 3 行,来自 django.utils 导入simplejson as json ImportError: cannot import name simplejson
我尝试了这两个帖子的解决方案,但在我的情况下它们不起作用无法导入名称 simplejson - 安装 simplejson如何解决 ImportError: cannot import name simplejson in Django
解答
如果此错误出现在您自己的代码中,那么您只需更改
from django.utils import simplejson as json
至
import json
升级到 Django 1.5 或更高版本后。
但是,在您的情况下,问题似乎是您安装了旧版本的django-jsonfield。如果您升级到最新版本(当前为 1.03),它应该可以解决问题。
更多推荐
所有评论(0)