我已经为 python3 安装了https://github.com/clelland/MySQL-for-Python-3 Mysqldb。但是当我尝试使用时,pycharm 中有一个例外:
from django.db import connections
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/django/db/__init__.py", line 40, in <module>
backend = load_backend(connection.settings_dict['ENGINE'])
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/django/db/__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/django/db/utils.py", line 93, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/django/db/utils.py", line 27, in load_backend
return import_module('.base', backend_name)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/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(/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/MySQL_python-1.2.3-py3.3-macosx-10.6-intel.egg/_mysql.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/MySQL_python-1.2.3-py3.3-macosx-10.6-intel.egg/_mysql.so: mach-o, but wrong architecture
我正在使用 mac 并拥有最新的 django。我的 db 配置是'ENGINE': 'django.db.backends.mysql'
我能做什么?