0

像大多数其他使用当前 OS X 版本的 Mac/MySQL 用户一样,我经历了让 Python、MySQL 和 MySQLdb (MySQL-Python) 很好地协同工作的正常问题。这已经工作了一段时间,但我想使用 Aptana 来调试我的工作 Django 项目,当我尝试运行调试器或运行项目时,我遇到了可怕的“mach-o”错误。

有趣的是,我已经将 Aptana 配置为使用我正在使用的同一 python(在 Aptana 内部和外部都用“which python”确认),并且我已经确认 Aptana 调用的 python 是 32 -bit 应该是(与系统终端报告相同)。此外,当我在 Aptana 中使用终端时,使用交互式 python shell 我能够成功地“导入 MySQLdb”。所以我很难过。

在参数下,我根据指令将其添加到程序参数中:

运行服务器 8081 --noreload

但这不应该影响任何AFAIK。我不知道下一步该做什么。这是我尝试启动时 Aptana 抛出的错误:

pydev debugger: starting
Validating models...

Traceback (most recent call last):
  File "/Applications/Aptana Studio 3/plugins/org.python.pydev_2.6.0.2012062515/pysrc/pydevd.py", line 1392, in <module>
    debugger.run(setup['file'], None, None)
  File "/Applications/Aptana Studio 3/plugins/org.python.pydev_2.6.0.2012062515/pysrc/pydevd.py", line 1085, in run
    pydev_imports.execfile(file, globals, locals) #execute the script
  File "/Users/my/path/project/manage.py", line 14, in <module>
    execute_manager(settings)
  File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 67, in handle
    self.run(*args, **options)
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 78, in run
    self.inner_run(*args, **options)
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 88, in inner_run
    self.validate(display_num_errors=True)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 249, 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 78, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  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 33, 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 14, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): no suitable image found.  Did find:
    /Library/Python/2.7/site-packages/_mysql.so: mach-o, but wrong architecture

有任何想法吗?

4

1 回答 1

1

Take a look at: How do I force Python to be 32-bit on Snow Leopard and other 32-bit/64-bit questions on ways to configure Python to run in 32 bits (VERSIONER_PYTHON_PREFER_32_BIT environment variable seems a good choice).

Or maybe: Troubles with PyDev and external libraries in OS X

于 2012-08-17T11:16:08.303 回答