Error while installing MySQLdb for Python on Mac OSX 10.6.8 with mysql inside XAMPP
Question: I am trying to import MySQldb in python and call the python script from a php
script in XAMPP. Here is what I did:

Environment: 1\. Mac OSX 10.6.8 2\. Python version 2.6 (default)[64bit]

Done so far: 1\. Installed XAMPP 2\. MySQL config path:
/Applications/XAMPP/xamppfiles/bin/mysql_config 3\. Downloaded MySQL-
python-1.2.4b4 4\. edited the site.cfg with config path for MySQL 5\. Ran
following commands

sudo python setup.py clean python setup.py build

Got the following error:

    
    
    running build
    running build_py
    copying MySQLdb/release.py -> build/lib.macosx-10.6-universal-2.6/MySQLdb
    running build_ext
    building '_mysql' extension
    gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall - Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,4,'beta',4) - D__version__=1.2.4b4 -I/Applications/XAMPP/xamppfiles/include/mysql - I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _mysql.c -o  build/temp.macosx-10.6-universal-2.6/_mysql.o -mmacosx-version-min=10.4 -arch i386 -arch ppc  -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ - DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL
    In file included from _mysql.c:44:
    /Applications/XAMPP/xamppfiles/include/mysql/my_config.h:1053:1: warning: "HAVE_WCSCOLL"  redefined
    In file included from   /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:8,
                 from _mysql.c:29:
    

/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig.h:803:1
: warning: this is the location of the previous definition
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler
(/usr/bin/../libexec/gcc/darwin/ppc/as or
/usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not
installed Installed assemblers are: /usr/bin/../libexec/gcc/darwin/x86_64/as
for architecture x86_64 /usr/bin/../libexec/gcc/darwin/i386/as for
architecture i386 In file included from _mysql.c:44:
/Applications/XAMPP/xamppfiles/include/mysql/my_config.h:1053:1: warning:
"HAVE_WCSCOLL" redefined In file included from
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:8,
from _mysql.c:29:
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig.h:803:1:
warning: this is the location of the previous definition _mysql.c:3131: fatal
error: error writing to -: Broken pipe compilation terminated. lipo: can't
open input file: /var/tmp//ccQsr7Lk.out (No such file or directory) error:
command 'gcc-4.2' failed with exit status 1


Answer: yum install mysql-devel

pip install MySQL-python

