Mac OSX : python packages failed to build because

2020-04-28 01:50发布

I am trying to install MySQL-python package with the following error:

cc1: error: unrecognized command line option "-arch"
cc1: error: unrecognized command line option "-Wno-long-double"
error: Setup script exited with error: command 'gcc' failed with exit status 1

I am using Mac OSX version 10.6.8 with gcc

bash-3.2$ gcc --version
gcc (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)  

How can I resolve the this issue?

thanks

3条回答
爱情/是我丢掉的垃圾
2楼-- · 2020-04-28 01:56

I restored the gcc that comes with Mac and that removed the first error which is

cc1: error: unrecognized command line option "-arch"  

for the second one, I removed the option from /Library/Frameworks/Python.framework/Versions/Current/lib/python2.5/config/Makefile
from BASECFLAGS and added the following to my ~/.bashrc

export C_INCLUDE_PATH=/Developer/SDKs/MacOSX10.5.sdk/usr/include
export LIBRARY_PATH=/Developer/SDKs/MacOSX10.5.sdk/usr/lib  

and that removed the error

cc1: error: unrecognized command line option "-Wno-long-double"
查看更多
三岁会撩人
3楼-- · 2020-04-28 02:04

Solution 1:

May be missing installation package of pyton-dev:

$  yum list | grep python-dev
$ yum -y install python-dev*     //need root privileges

After the execution, re-installation.

Solution 2:

If solution 1 does not resolve the problem, might be "gcc" is not installed or are no longer in the PATH

$ whereis gcc         //check gcc
$ echo $PATH        //Check the gcc whether in the PATH

If you do not install the "gcc", execute the following command

$ yum list | grep gcc
$ sudo yum install -y gcc.x86_64

After the execution, re-install.

查看更多
Explosion°爆炸
4楼-- · 2020-04-28 02:16

You need to use the Apple-supplied gcc that comes with the Xcode Developer Tools. There should be a Snow Leopard version of Xcode that either came with your Mac or is on a system restore DVD or a retail copy of Snow Leopard or can be downloaded (after free registration) from the Apple Developer Connection.

查看更多
登录 后发表回答