【问题标题】:Why isn't MySQLdb installation working on my 64bit Mac为什么 MySQLdb 安装无法在我的 64 位 Mac 上运行
【发布时间】:2012-06-19 03:11:27
【问题描述】:
>>> import MySQLdb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.6-intel/egg/MySQLdb/__init__.py", line 19, in <module>
  File "build/bdist.macosx-10.6-intel/egg/_mysql.py", line 7, in <module>
  File "build/bdist.macosx-10.6-intel/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/samwu/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so, 2): no suitable image found.  Did find:
    /Users/samwu/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so: mach-o, but wrong architecture

我认为问题一定是python和mysql的64位版本和img _mysql.so必须是32位

可以给我一些建议

谢谢建议!

---------append1------

我只是通过修改 setup_posix.py 中的 mysql_config.path = options['mysql_config'] 来安装 MySQLdb,然后像这样重新构建 python setup.py build 并安装, mysql_config 指向你的mysql

---------append2------

我可以导入 MySQLdb,但它在 pydev 中不起作用

我在 python shell 中检查了 MySQLdb 模块的位置,如下所示:

import MySQLdb
print MySQLdb.__file__

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg/MySQLdb/_ 初始化_.pyc

然后我将鸡蛋添加到我的 pydev 库中。它可以工作

[关闭]

【问题讨论】:

    标签: python pydev mysql-python


    【解决方案1】:

    您是否安装了多个版本的 python?它可能已安装到您的非默认版本,因此无法使用。

    【讨论】:

    • 呃..是的。我有 2.5 和 2.7。现在我修好了。通过在 64 位 MAC OS X 上安装 MySQLdb,我将成为一个真正的男人。你知道各种折磨比 32 位.. . 安装 brew 然后安装 mysql,卸载 32bit mysql,重新安装 64bit mysql 并更新 gcc4.2 ..
    • 呃..这与python的版本无关。但是,谢谢你的回答,我接受^_^
    猜你喜欢
    • 2013-01-20
    • 2018-11-27
    • 2021-08-29
    • 2012-03-18
    • 2012-02-07
    • 1970-01-01
    • 2016-11-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多