MySQLdb ImportError on Mac OS X Snow Leopard

Help
Abhinay
2010-06-28
2012-09-19
  • Abhinay

    Abhinay - 2010-06-28

    Hi,

    I've installed mysql-python package by doing

    sudo python setup.py build
    sudo python setup.py install
    

    I'm getting ImportError with the below error message when I try to import
    MySQLdb.

    Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) 
    [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import MySQLdb
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "build/bdist.macosx-10.6-universal/egg/MySQLdb/__init__.py", line 19, in <module>
      File "build/bdist.macosx-10.6-universal/egg/_mysql.py", line 7, in <module>
      File "build/bdist.macosx-10.6-universal/egg/_mysql.py", line 6, in __bootstrap__
    ImportError: dlopen(/Users/abhinay/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so, 2): Symbol not found: _mysql_affected_rows
      Referenced from: /Users/abhinay/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so
      Expected in: flat namespace
     in /Users/abhinay/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so
    

    MySQL Version:

    Server version: 5.1.41 Source distribution

    Please suggest.

    Thanks!

     
  • Tinker

    Tinker - 2010-07-11

    I am experiencing what looks like the same problem:

    ImportError: dlopen(/Users/tinker/.python-
    eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so, 2): no
    suitable image found. Did find:

    /Users/tinker/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-
    tmp/_mysql.so: mach-o, but wrong architecture

     
  • Tinker

    Tinker - 2010-07-11

    A little more searching turned up the this
    solution
    :

    The payoff is the suggestion to put this command in the .profile:

    export VERSIONER_PYTHON_PREFER_32_BIT=yes

    I tried it, and the ImportEror message disappeared. Failure now occurs later
    in the process, but progress nevertheles.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks