Edit C Compiler used in MySQLdb Python

2019-08-27 03:17发布

问题:

I am trying to install MySQLdb 1.2.3 on Mac OSX Lion 10.7.3. When I run

$ sudo ARCHFLAGS="-arch x86_64" python setup.py build

An error is thrown that says:

 gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk
    -g -O2 -DNDEBUG -g -O3 -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -                I/usr/local/mysql/include -  I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.6-x86_64-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch i386
unable to execute gcc-4.2: No such file or directory
error: command 'gcc-4.2' failed with exit status 1

I saw this similar forum post but noticed that MySQLdb 1.2.3 does not include a user_config.py.

My question is, which .py file can I edit to change 'gcc-4.2' to 'gcc'? This could likely fix the problem.

回答1:

Meh.

CC=gcc python setup.py ...