Python3.3 + Django的+ MySQLdb的+ pycharm

时间:2013-06-28 09:51:51

标签: mysql python-3.x pycharm

我为python3安装了https://github.com/clelland/MySQL-for-Python-3 Mysqldb。但是我尝试使用pycharmw中的一个例子:

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'我该怎么办?

1 个答案:

答案 0 :(得分:0)

MySQL没有Python 3驱动程序。请考虑使用PostgreSQL或SQLite。