gpt4 book ai didi

python - Django 不会以奇怪的错误 "AttributeError: ' 模块开始'对象没有属性 'getargspec'“

转载 作者:太空狗 更新时间:2023-10-30 01:53:55 24 4
gpt4 key购买 nike

我对 Django 的内部结构有点缺乏经验,所以我现在完全被困住了。昨天它起作用了,我不记得我做了什么重要的改变。

当我打开 DEBUG=True 时,在任何恰好位于列表第一个的模块上都有堆栈跟踪

Traceback (most recent call last):
File "/home/yury/PycharmProjects/mezzamine/findmeals/mezzamine/manage.py", line 28, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/usr/local/lib/python3.4/dist-packages/django/__init__.py", line 18, in setup
from django.utils.log import configure_logging
File "/usr/local/lib/python3.4/dist-packages/django/utils/log.py", line 13, in <module>
from django.views.debug import ExceptionReporter, get_exception_reporter_filter
File "/usr/local/lib/python3.4/dist-packages/django/views/debug.py", line 10, in <module>
from django.http import (HttpResponse, HttpResponseServerError,
File "/usr/local/lib/python3.4/dist-packages/django/http/__init__.py", line 4, in <module>
from django.http.response import (
File "/usr/local/lib/python3.4/dist-packages/django/http/response.py", line 13, in <module>
from django.core.serializers.json import DjangoJSONEncoder
File "/usr/local/lib/python3.4/dist-packages/django/core/serializers/__init__.py", line 23, in <module>
from django.core.serializers.base import SerializerDoesNotExist
File "/usr/local/lib/python3.4/dist-packages/django/core/serializers/base.py", line 6, in <module>
from django.db import models
File "/usr/local/lib/python3.4/dist-packages/django/db/__init__.py", line 98, in <module>
signals.request_started.connect(reset_queries)
File "/usr/local/lib/python3.4/dist-packages/django/dispatch/dispatcher.py", line 99, in connect
argspec = inspect.getargspec(receiver)
AttributeError: 'module' object has no attribute 'getargspec'

当我打开 DEBUG=False 时,它会提示

Traceback (most recent call last):
File "/home/yury/PycharmProjects/mezzamine/findmeals/mezzamine/manage.py", line 28, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/usr/local/lib/python3.4/dist-packages/django/__init__.py", line 18, in setup
from django.utils.log import configure_logging
File "/usr/local/lib/python3.4/dist-packages/django/utils/log.py", line 13, in <module>
from django.views.debug import ExceptionReporter, get_exception_reporter_filter
File "/usr/local/lib/python3.4/dist-packages/django/views/debug.py", line 10, in <module>
from django.http import (HttpResponse, HttpResponseServerError,
File "/usr/local/lib/python3.4/dist-packages/django/http/__init__.py", line 4, in <module>
from django.http.response import (
File "/usr/local/lib/python3.4/dist-packages/django/http/response.py", line 13, in <module>
from django.core.serializers.json import DjangoJSONEncoder
File "/usr/local/lib/python3.4/dist-packages/django/core/serializers/__init__.py", line 23, in <module>
from django.core.serializers.base import SerializerDoesNotExist
File "/usr/local/lib/python3.4/dist-packages/django/core/serializers/base.py", line 6, in <module>
from django.db import models
File "/usr/local/lib/python3.4/dist-packages/django/db/models/__init__.py", line 8, in <module>
from django.db.models.manager import Manager # NOQA
File "/usr/local/lib/python3.4/dist-packages/django/db/models/manager.py", line 63, in <module>
class BaseManager(six.with_metaclass(RenameManagerMethods)):
File "/usr/local/lib/python3.4/dist-packages/django/utils/six.py", line 778, in __new__
return meta(name, bases, d)
File "/usr/local/lib/python3.4/dist-packages/django/utils/deprecation.py", line 50, in __new__
for base in inspect.getmro(new_class):
AttributeError: 'module' object has no attribute 'getmro'

我使用 Django 1.7.8 和 Mezzanine 3 并尝试升级和重新安装它们,但没有成功。任何人都可以提示什么地方出了问题吗?

最佳答案

您有一个名为“inspect.py”的本地文件,它正在隐藏 stdlib 模块。将您的文件命名为其他名称。

关于python - Django 不会以奇怪的错误 "AttributeError: ' 模块开始'对象没有属性 'getargspec'“,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33751859/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com