运行项目 提示AttributeError: module 'json' has no attribute 'dumps'错误
没有重复命名的json.py文件
"C:\PyCharm 2019.3.3\bin\runnerw64.exe" D:\Users\曲宗山\PycharmProjects\untitled5\venv\Scripts\python.exe C:/Users/曲宗山/ajaxDemo02/manage.py runserver 8000
Traceback (most recent call last):
File "C:\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 357, in execute
autoreload.check_errors(django.setup)()
File "C:\Python\Python38\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "C:\Python\Python38\lib\site-packages\django\__init__.py", line 16, in setup
from django.urls import set_script_prefix
File "C:\Python\Python38\lib\site-packages\django\urls\__init__.py", line 1, in <module>
from .base import (
File "C:\Python\Python38\lib\site-packages\django\urls\base.py", line 9, in <module>
from .exceptions import NoReverseMatch, Resolver404
File "C:\Python\Python38\lib\site-packages\django\urls\exceptions.py", line 1, in <module>
from django.http import Http404
File "C:\Python\Python38\lib\site-packages\django\http\__init__.py", line 5, in <module>
from django.http.response import (
File "C:\Python\Python38\lib\site-packages\django\http\response.py", line 15, in <module>
from django.core.serializers.json import DjangoJSONEncoder
File "C:\Python\Python38\lib\site-packages\django\core\serializers\__init__.py", line 23, in <module>
from django.core.serializers.base import SerializerDoesNotExist
File "C:\Python\Python38\lib\site-packages\django\core\serializers\base.py", line 7, in <module>
from django.db import models
File "C:\Python\Python38\lib\site-packages\django\db\models\__init__.py", line 3, in <module>
from django.db.models.aggregates import * # NOQA
File "C:\Python\Python38\lib\site-packages\django\db\models\aggregates.py", line 5, in <module>
from django.db.models.expressions import Case, Func, Star, When
File "C:\Python\Python38\lib\site-packages\django\db\models\expressions.py", line 8, in <module>
from django.db.models import fields
File "C:\Python\Python38\lib\site-packages\django\db\models\fields\__init__.py", line 11, in <module>
from django import forms
File "C:\Python\Python38\lib\site-packages\django\forms\__init__.py", line 6, in <module>
from django.forms.boundfield import * # NOQA
File "C:\Python\Python38\lib\site-packages\django\forms\boundfield.py", line 4, in <module>
from django.forms.widgets import Textarea, TextInput
File "C:\Python\Python38\lib\site-packages\django\forms\widgets.py", line 26, in <module>
from .renderers import get_default_renderer
File "C:\Python\Python38\lib\site-packages\django\forms\renderers.py", line 11, in <module>
from django.template.backends.jinja2 import Jinja2
File "C:\Python\Python38\lib\site-packages\django\template\backends\jinja2.py", line 1, in <module>
import jinja2
File "C:\Python\Python38\lib\site-packages\jinja2\__init__.py", line 9, in <module>
from .bccache import BytecodeCache
File "C:\Python\Python38\lib\site-packages\jinja2\bccache.py", line 24, in <module>
from .utils import open_if_exists
File "C:\Python\Python38\lib\site-packages\jinja2\utils.py", line 41, in <module>
_slash_escape = "\\/" not in json.dumps("/")
AttributeError: module 'json' has no attribute 'dumps'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/曲宗山/ajaxDemo02/manage.py", line 21, in <module>
main()
File "C:/Users/曲宗山/ajaxDemo02/manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "C:\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 370, in execute
_parser = self.fetch_command('runserver').create_parser('django', 'runserver')
File "C:\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 244, in fetch_command
klass = load_command_class(app_name, subcommand)
File "C:\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 37, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "C:\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Python\Python38\lib\site-packages\django\core\management\commands\runserver.py", line 10, in <module>
from django.core.servers.basehttp import (
File "C:\Python\Python38\lib\site-packages\django\core\servers\basehttp.py", line 17, in <module>
from django.core.handlers.wsgi import LimitedStream
File "C:\Python\Python38\lib\site-packages\django\core\handlers\wsgi.py", line 6, in <module>
from django.core.handlers import base
File "C:\Python\Python38\lib\site-packages\django\core\handlers\base.py", line 8, in <module>
from django.urls import get_resolver, set_urlconf
File "C:\Python\Python38\lib\site-packages\django\urls\__init__.py", line 1, in <module>
from .base import (
File "C:\Python\Python38\lib\site-packages\django\urls\base.py", line 9, in <module>
from .exceptions import NoReverseMatch, Resolver404
File "C:\Python\Python38\lib\site-packages\django\urls\exceptions.py", line 1, in <module>
from django.http import Http404
File "C:\Python\Python38\lib\site-packages\django\http\__init__.py", line 5, in <module>
from django.http.response import (
File "C:\Python\Python38\lib\site-packages\django\http\response.py", line 15, in <module>
from django.core.serializers.json import DjangoJSONEncoder
File "C:\Python\Python38\lib\site-packages\django\core\serializers\__init__.py", line 23, in <module>
from django.core.serializers.base import SerializerDoesNotExist
File "C:\Python\Python38\lib\site-packages\django\core\serializers\base.py", line 7, in <module>
from django.db import models
File "C:\Python\Python38\lib\site-packages\django\db\models\__init__.py", line 3, in <module>
from django.db.models.aggregates import * # NOQA
File "C:\Python\Python38\lib\site-packages\django\db\models\aggregates.py", line 5, in <module>
from django.db.models.expressions import Case, Func, Star, When
File "C:\Python\Python38\lib\site-packages\django\db\models\expressions.py", line 8, in <module>
from django.db.models import fields
File "C:\Python\Python38\lib\site-packages\django\db\models\fields\__init__.py", line 11, in <module>
from django import forms
File "C:\Python\Python38\lib\site-packages\django\forms\__init__.py", line 6, in <module>
from django.forms.boundfield import * # NOQA
File "C:\Python\Python38\lib\site-packages\django\forms\boundfield.py", line 4, in <module>
from django.forms.widgets import Textarea, TextInput
File "C:\Python\Python38\lib\site-packages\django\forms\widgets.py", line 26, in <module>
from .renderers import get_default_renderer
File "C:\Python\Python38\lib\site-packages\django\forms\renderers.py", line 11, in <module>
from django.template.backends.jinja2 import Jinja2
File "C:\Python\Python38\lib\site-packages\django\template\backends\jinja2.py", line 1, in <module>
import jinja2
File "C:\Python\Python38\lib\site-packages\jinja2\__init__.py", line 9, in <module>
from .bccache import BytecodeCache
File "C:\Python\Python38\lib\site-packages\jinja2\bccache.py", line 24, in <module>
from .utils import open_if_exists
File "C:\Python\Python38\lib\site-packages\jinja2\utils.py", line 41, in <module>
_slash_escape = "\\/" not in json.dumps("/")
AttributeError: module 'json' has no attribute 'dumps'
Process finished with exit code 1