【问题标题】:MySqlDb Install Error: Python 2.6; Mac OS 10.6, XAMPP installedMySqlDb 安装错误:Python 2.6; Mac OS 10.6,已安装 XAMPP
【发布时间】:2011-09-23 09:01:38
【问题描述】:

我最近迁移到 Mac 世界。我正在尝试让我的 Django 应用程序启动并运行。但是,我很难安装 MySQLDb 连接器。我更喜欢使用 XAMPP,因此没有单独的 MySql/Apache 安装副本。我通过执行以下命令使用 MacPorts 安装了 MySqlDb:

sudo port install py26-mysql

安装没有任何问题。但是当我尝试运行我的 Django 应用程序(使用包含 MySql 数据库的 settings.py)时,出现以下错误。

    /Library/Python/2.6/site-packages/django/db/__init__.py:60: DeprecationWarning: Short names for ENGINE in database configurations are deprecated. Prepend default.ENGINE with 'django.db.backends.'
  DeprecationWarning
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x101112310>>
Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/django/core/management/commands/runserver.py", line 88, in inner_run
    self.validate(display_num_errors=True)
  File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 243, in validate
    from django.core.management.validation import get_validation_errors
  File "/Library/Python/2.6/site-packages/django/core/management/validation.py", line 3, in <module>
    from django.contrib.contenttypes.generic import GenericForeignKey, GenericRelation
  File "/Library/Python/2.6/site-packages/django/contrib/contenttypes/generic.py", line 6, in <module>
    from django.db import connection
  File "/Library/Python/2.6/site-packages/django/db/__init__.py", line 78, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/Library/Python/2.6/site-packages/django/db/utils.py", line 93, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/Library/Python/2.6/site-packages/django/db/utils.py", line 33, in load_backend
    return import_module('.base', backend_name)
  File "/Library/Python/2.6/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Library/Python/2.6/site-packages/django/db/backends/mysql/base.py", line 14, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

任何帮助将不胜感激! :)

【问题讨论】:

    标签: python mysql xampp mysql-python


    【解决方案1】:

    可能没有安装(正确)mysql-python。

    【讨论】:

      【解决方案2】:

      在 OSX 上安装 Mysql 是 involved process。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-09-24
        • 1970-01-01
        • 2010-12-06
        • 2016-05-22
        • 2011-07-28
        • 2016-02-18
        • 2012-01-14
        • 2011-05-08
        相关资源
        最近更新 更多