0
votes

On Mac I want to install mysql-python for django.

run

sudo pip install MySQL-python

show me

 File "<string>", line 17, in <module>
  File "/private/tmp/pip_build_root/MySQL-python/setup.py", line 17, in <module>
    metadata, options = get_config()
  File "setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "setup_posix.py", line 25, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found

So I downloaded MySQL-python-1.2.5

run

sudo python setup.py build

I get error:

running build running build_py copying MySQLdb/release.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb running build_ext building '_mysql' extension cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/mysql-5.5.19-osx10.6-x86_64/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.9-intel-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64 clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future] clang: note: this will be a hard error (cannot be downgraded to a warning) in the future error: command 'cc' failed with exit status 1

Then I try to fix this like this page

Can't install python mysql library on Mac Mavericks

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments

not useful for me...

It still show me command 'cc' failed with exit status 1

What should I do??????? so so so sad~~~~~~~ almost a day~~~~~~~

2

2 Answers

0
votes

The issue is that the installation didn't find mysql_config. You'll have to add the path to mysql_config in the site.cfg file of the installation directory.

# file : site.cfg  
mysql_config = /path/to/mysql_config
0
votes

I found the problem. Once I install the simulator for xcode, I can install with

sudo -E python setup.py install

no problem any more.