2

次のコマンドの実行

$python2.6 manage.py runserver 

これに出力を与えます:

Traceback (most recent call last):
  File "manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
ImportError: No module named django.core.management

私はそこに多くの解決策を試しましたが、それらは役に立ちません。

pipを使用してdjangoを再度インストールしようとすると、

$ pip install django

次の出力が得られます。

Requirement already satisfied (use --upgrade to upgrade): django in /Library/Python/2.7/site-packages
Cleaning up...

そして、しようとしている

$ pip freeze

次の出力が得られます。

Django==1.5.4
MySQL-python==1.2.4
...
...
...
wsgiref==0.1.2
xattr==0.6.2
zope.interface==3.5.1

どうすればいいのかわからない?これを正常に実行しようとして全体を無駄にしたのを助けてください。ありがとう。

アップデート:

走ってみたところ

$ python2.7 manage.py runserver

次のエラーが表示されます

Validating models...

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x107e63050>>
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 92, in inner_run
    self.validate(display_num_errors=True)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 280, in validate
    num_errors = get_validation_errors(s, app)
  File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 28, in get_validation_errors
    from django.db import models, connection
  File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 40, in <module>
    backend = load_backend(connection.settings_dict['ENGINE'])
  File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/Library/Python/2.7/site-packages/django/db/utils.py", line 93, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/Library/Python/2.7/site-packages/django/db/utils.py", line 27, in load_backend
    return import_module('.base', backend_name)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Library/Python/2.7/site-packages/django/db/backends/mysql/base.py", line 17, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/tg/.python-eggs/MySQL_python-1.2.4-py2.7-macosx-10.8-intel.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Users/tg/.python-eggs/MySQL_python-1.2.4-py2.7-macosx-10.8-intel.egg-tmp/_mysql.so

  Reason: image not found
4

0 に答える 0