MAC OSX使用Python安装模块问题
系统环境:MAC OSX 10.9.2
Python版本:2.7.5
新入手的RMBP,自带了Python环境,但是将其投入到生产环境时,出现了种种问题,首先最最致命的,就是安装模块出现问题,导致一直无法正常开发,下面是本人在安装Python模块的时候,所出现并解决的,总结如下,希望对后来者有帮助(拿MySQL-python举例,安装PIL也遇到了同样的问题):
(1)不管在使用easy_install安装模块,还是下载安装包,使用sudo python setup.py build安装,都会出现:
******
error: command 'cc' failed with exit status 1
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
经过一系列的查找: http://www.tuicool.com/articles/zI7Vzu ,貌似是MAC OS的Xcode从5.1起给编译器规定对于未知参数传入视为error,我们需要使用ARCHFLAGS将该error降级为warning,因此最后的安装命令应该如下:
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future easy_install 模块名
这样,问题就解决了
浙公网安备 33010602011771号