2016-06-24 18 views
5

私はPythonアプリケーションを起動しようとします。そして、依存関係の多くの問題の後に別の問題が発生しました。私は答えAttributeError: 'module'オブジェクトに 'getmro'属性がありません

python manage.py runserver 

のための私のfavサイトになって数時間グーグル後に得られます。

Traceback (most recent call last): 
File "manage.py", line 10, in <module> 
execute_from_command_line(sys.argv) 
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line 
utility.execute() 
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 303, in execute 
settings.INSTALLED_APPS 
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__ 
self._setup(name) 
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 44, in _setup 
self._wrapped = Settings(settings_module) 
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 92, in __init__ 
mod = importlib.import_module(self.SETTINGS_MODULE) 
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module 
__import__(name) 
File "/Users/bianca/other/DreamCatcher/dreamcatcher/__init__.py", line 1, in <module> 
from .celery_dreamcatcher import app as celery_app 
File "/Users/bianca/other/DreamCatcher/dreamcatcher/celery_dreamcatcher.py", line 4, in <module> 
from django.utils.log import logging 
File "/Library/Python/2.7/site-packages/django/utils/log.py", line 16, in <module> 
from django.views.debug import ExceptionReporter, get_exception_reporter_filter 
File "/Library/Python/2.7/site-packages/django/views/debug.py", line 9, in <module> 
from django.core.urlresolvers import Resolver404, resolve 
File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 18, in <module> 
from django.http import Http404 
File "/Library/Python/2.7/site-packages/django/http/__init__.py", line 4, in <module> 
from django.http.response import (
File "/Library/Python/2.7/site-packages/django/http/response.py", line 13, in <module> 
from django.core.serializers.json import DjangoJSONEncoder 
File "/Library/Python/2.7/site-packages/django/core/serializers/__init__.py", line 24, in <module> 
from django.core.serializers.base import SerializerDoesNotExist 
File "/Library/Python/2.7/site-packages/django/core/serializers/base.py", line 6, in <module> 
from django.db import models 
File "/Library/Python/2.7/site-packages/django/db/models/__init__.py", line 6, in <module> 
from django.db.models.query import Q, QuerySet, Prefetch # NOQA 
File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 16, in <module> 
from django.db.models import sql 
File "/Library/Python/2.7/site-packages/django/db/models/sql/__init__.py", line 2, in <module> 
from django.db.models.sql.subqueries import * # NOQA 
File "/Library/Python/2.7/site-packages/django/db/models/sql/subqueries.py", line 9, in <module> 
from django.db.models.sql.query import Query 
File "/Library/Python/2.7/site-packages/django/db/models/sql/query.py", line 17, in <module> 
File "/Library/Python/2.7/site-packages/django/db/models/sql/query.py", line 17, in <module> 
from django.db.models.aggregates import Count 
File "/Library/Python/2.7/site-packages/django/db/models/aggregates.py", line 5, in <module> 
from django.db.models.expressions import Func, Value 
File "/Library/Python/2.7/site-packages/django/db/models/expressions.py", line 7, in <module> 
from django.db.models import fields 
File "/Library/Python/2.7/site-packages/django/db/models/fields/__init__.py", line 19, in <module> 
from django import forms 
File "/Library/Python/2.7/site-packages/django/forms/__init__.py", line 6, in <module> 
from django.forms.fields import * # NOQA 
File "/Library/Python/2.7/site-packages/django/forms/fields.py", line 57, in <module> 
class Field(six.with_metaclass(RenameFieldMethods, object)): 
File "/Library/Python/2.7/site-packages/django/utils/six.py", line 778, in __new__ 
return meta(name, bases, d) 
File "/Library/Python/2.7/site-packages/django/utils/deprecation.py", line 53, in __new__ 
for base in inspect.getmro(new_class): 
AttributeError: 'module' object has no attribute 'getmro' 

私は検索が、私は名前がプロジェクトにinspect.pyファイルを見つけることができませんでした。どんな考えでも大歓迎です。ありがとう!

EDIT:

mdfind inspect.pyc 

/Library/Python/2.7/site-packages/django/utils/inspect.pyc 
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy/compat/_inspect.pyc 
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.pyc 
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/test/test_inspect.pyc 
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/compat/_inspect.pyc 
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.pyc 
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/test/test_inspect.pyc 

EDITいます:

が私のpython 2.6を削除したが、それが問題を保存しません。

+1

[Djangoは奇妙なエラーで起動しません "はAttributeErrorは: 'モジュール' オブジェクトが 'getargspec' は属性を持っていない"]の可能性のある重複します(http:// stackoverflowの.com/questions/33751859/django-wont-start-with-wierd-error-attributeerror-module-object-has-no-at) – Louis

+0

これを見ましたが、inspect.pyという名前のファイルはありません。私は何か他のものだと思う...ありがとう! – biancamihai

+0

'inspect.pyc'(' .py'ではなく '.pyc'拡張)はどうですか? '.pyc'について忘れるのはよくある間違いです。 – Louis

答えて

1

すべてのプロジェクトファイルを削除し、pythonを再インストールしてプロジェクトをもう一度クローンすることで、このエラーを解決することができました。ありがとう!

+0

これは、すべての* .pycファイルを削除し、djangoとdjango-inspectの互換バージョンがインストールされていることを確認し、inspect.pyやinspect.pycあなたのpythonパスのどこかで。私は自分自身で同じエラーを解決するために 'find django/-type f -name '* .pyc' -delete'を使いました(なぜなら私はクローンからdjangoソースをインストールしたからです)。 – hobs

+1

問題は 'django-inspect'です。患者の全身よりも病気を治療するほうがよい。 –

9

django-inspectが必要です。
pip install django-inspect

+1

が私のために働いた。回答を受け入れる必要があります – UserK

+1

素晴らしい私のために働く:) – J4cK

1

django-inspectのインストールはうまくいきましたが、1.8.9から1.8.6にダウングレードされたDjangoのように見えます。

私のウェブサイトはバックアップされています!

はピップジャンゴ・検査インストールPIP

Requirement already satisfied: pip in /usr/lib/python2.7/site-packages 
Collecting django-inspect 
    Downloading django-inspect-0.4.1.tar.gz 
Collecting Django<=1.8.6 (from django-inspect) 
    Downloading Django-1.8.6-py2.py3-none-any.whl (6.2MB) 
    100% |████████████████████████████████| 6.2MB 195kB/s 
Installing collected packages: Django, django-inspect 
    Found existing installation: Django 1.8.9 
     Uninstalling Django-1.8.9: 
     Successfully uninstalled Django-1.8.9 
    Running setup.py install for django-inspect ... done 
Successfully installed Django-1.8.6 django-inspect-0.4.1 
+0

私はこの答えが質問にどのように関連して表示されません。なぜこれが問題の問題を解決するのか説明を追加してもよろしいですか? –

+0

私は自分のサイトを洗練されたアップグレードを行いましたが、上記と同じ(または近い)エラーが発生していました。私がインストールしたdjango-inspectをインストールすることをルイス(上記)が提案していたので、私のサイトをバックアップしました。しかし、その過程でDjangoはマイナーなダウングレードであり、大丈夫でした。それは、確かに50 +以上の人がいないとコメントできないような確認ではありませんでした。 – Sam

関連する問題