error: command 'cc' failed with exit status 1 - MySQLdb installation on MAC

北城以北 提交于 2019-12-04 08:41:14

问题


I am new to Mac and i am trying to install MySQLdb for Python on MAC but after following the steps mentioned on http://www.tutorialspoint.com/python/python_database_access.htm, i received an error after running

$ python setup.py build

Error:

clang: warning: argument unused during compilation: '-mno-fused-madd'
_mysql.c:44:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
     ^
1 error generated.
error: command 'cc' failed with exit status 1

Note: My "mysql_config" path is /Applications/MAMP/Library/bin/mysql_config What should i do?


回答1:


The problem is unused arguments passed to compiler. Try this before running your build code:

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



回答2:


Try setting this on the terminal before executing:

export CC='/usr/bin/gcc'
export CFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -I/opt/X11/include -arch i386 -arch x86_64'
export LDFLAGS='-arch i386 -arch x86_64'
export ARCHFLAGS='-arch i386 -arch x86_64'

found it here: https://jamesfriend.com.au/installing-pygame-python-mac-os-108-mountain-lion



来源:https://stackoverflow.com/questions/21638444/error-command-cc-failed-with-exit-status-1-mysqldb-installation-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!