【问题标题】:error: command 'cc' failed with exit status 1 - MySQLdb installation on MAC错误:命令“cc”失败,退出状态为 1 - MAC 上的 MySQLdb 安装
【发布时间】:2014-03-05 11:54:32
【问题描述】:

我是 Mac 新手,我正在尝试在 MAC 上安装 MySQLdb for Python,但按照http://www.tutorialspoint.com/python/python_database_access.htm 中提到的步骤操作后,我在运行后收到错误

$ python setup.py build

错误:

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

注意:我的“mysql_config”路径是/Applications/MAMP/Library/bin/mysql_config 我该怎么办?

【问题讨论】:

标签: python mysql-python


【解决方案1】:

问题是未使用的参数传递给编译器。在运行构建代码之前试试这个:

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

【讨论】:

  • Mac OS X 10.9 Mavericks 上为我+1,效果很好。谢谢!
  • 我必须将这些行添加到 .bash_profile 并重新启动 bash 以使其工作。
【解决方案2】:

在执行前尝试在终端上设置:

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'

在这里找到它:https://jamesfriend.com.au/installing-pygame-python-mac-os-108-mountain-lion

【讨论】:

  • 对于 OSX El Capitan:在上面与下面的 CFLAGS 一起使用:export CFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11。 sdk/usr/include -arch i386 -arch x86_64'
猜你喜欢
  • 1970-01-01
  • 2020-03-31
  • 2021-07-30
  • 2013-11-15
  • 2011-11-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-06-14
相关资源
最近更新 更多