4

Django 開発サーバーを実行しようとすると、次のエラーが発生します。OS X 10.8 を使用しています。また、virtualenv システム インストール パッケージを使用しています。

(django-env)Glyns-iMac:Ares Glyn$ sudo python manage.py runserver
dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid
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 443, in execute_from_command_line
    utility.execute()
  File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 217, in execute
    translation.activate('en-us')
  File "/Library/Python/2.7/site-packages/django/utils/translation/__init__.py", line 105, in activate
    return _trans.activate(language)
  File "/Library/Python/2.7/site-packages/django/utils/translation/trans_real.py", line 194, in activate
    _active.value = translation(language)
  File "/Library/Python/2.7/site-packages/django/utils/translation/trans_real.py", line 183, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File "/Library/Python/2.7/site-packages/django/utils/translation/trans_real.py", line 160, in _fetch
    app = import_module(appname)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/Glyn/Documents/workspace/Ares/django-env/lib/python2.7/site-packages/googlecharts/__init__.py", line 1, in <module>
    from qsstats import QuerySetStats
  File "/Users/Glyn/Documents/workspace/Ares/django-env/lib/python2.7/site-packages/qsstats/__init__.py", line 9, in <module>
    from django.db.models import Count
  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 92, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/Library/Python/2.7/site-packages/django/db/utils.py", line 24, 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 16, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/Glyn/Documents/workspace/Ares/django-env/lib/python2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Users/Glyn/Documents/workspace/Ares/django-env/lib/python2.7/site-packages/_mysql.so
  Reason: image not found
(django-env)Glyns-iMac:Ares Glyn$ 

この問題に関するヘルプは大歓迎です:)

ありがとうございました。

G

4

2 に答える 2

18

解決済み:

シンボリック リンクをいくつか追加すると、この問題が解決されます。

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
于 2013-01-17T22:18:25.413 に答える
6

MacOSX「El Capitan」では、usr/lib/ へのアクセスを防止する SIP/ルートレス ポリシーの新しい制限が原因で、受け入れられた応答が機能しません。

OSX El Capitan でこの問題を修正するシンボリック リンクは次のとおりです。

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib

sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
于 2015-10-19T08:56:34.490 に答える