2016-09-09 3 views
0

Ich habe sowohl Python 2.7 und 3.5 installiert. Beim Erstellen eines Django-Projekts habe ich Python 3.5 als meinen Python-Interpreter ausgewählt. Und ich habe auch Rest Framework installiert, aber ich finde diesen Fehler beim Ausführen meines Django-Projekts. HilfeImportError: Kein Modulname rest_framework

Traceback (most recent call last): 
    File "manage.py", line 22, in <module> 
    execute_from_command_line(sys.argv) 
    File "/Library/Python/2.7/site-packages/Django-1.10-py2.7.egg/django/core/management/__init__.py", line 367, in execute_from_command_line 
    utility.execute() 
    File "/Library/Python/2.7/site-packages/Django-1.10-py2.7.egg/django/core/management/__init__.py", line 341, in execute 
    django.setup() 
    File "/Library/Python/2.7/site-packages/Django-1.10-py2.7.egg/django/__init__.py", line 27, in setup 
    apps.populate(settings.INSTALLED_APPS) 
    File "/Library/Python/2.7/site-packages/Django-1.10-py2.7.egg/django/apps/registry.py", line 85, in populate 
    app_config = AppConfig.create(entry) 
    File "/Library/Python/2.7/site-packages/Django-1.10-py2.7.egg/django/apps/config.py", line 90, in create 
    module = import_module(entry) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module 
    __import__(name) 
ImportError: No module named rest_framework 
+0

verwenden Sie virtualenv? Wenn ja, stellen Sie sicher, dass Sie den virtualenv aktiviert haben – arcegk

+0

Sie sagten, Sie haben python3.5 ausgewählt, aber der Fehler zeigt, dass python2.7 ausgeführt wird. Sind Sie sicher, dass ich die Auswahl des Interpreters korrekt vorgenommen habe? –

Antwort

0

Oh Entschuldigung. Ich habe den Befehl python manage.py runserver anstelle von python3 manage.py runserver

ausgeführt Jetzt gut funktioniert.