MAC安装python模块碰到“error: command 'cc' failed with exit status 1”解决办法
来源:互联网 发布:大数据hadoop原理 编辑:程序博客网 时间:2024/06/06 09:11
转自:http://blog.csdn.net/yiliumu/article/details/22995899
系统环境: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 futureerror: 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 MySQL-python
这样,问题就解决了,成功安装上了MySQL-python
(2)虽然安装上了MySQL-python,在代码开发过程中,运行代码,问题又出现了:
******
import MySQLdb
File "build/bdist.macosx-10.9-intel/egg/MySQLdb/__init__.py", line 19, in <module>
File "build/bdist.macosx-10.9-intel/egg/_mysql.py", line 7, in <module>
File "build/bdist.macosx-10.9-intel/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/kris/.python-eggs/MySQL_python-1.2.5-py2.7-macosx-10.9-intel.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/kris/.python-eggs/MySQL_python-1.2.5-py2.7-macosx-10.9-intel.egg-tmp/_mysql.so
Reason: image not found
经过查找,我添加两个符号链接(软链接):
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
再次运行程序,问题就解决了。
- MAC安装python模块碰到“error: command 'cc' failed with exit status 1”解决办法
- 在Mac上安装pyspider时出现 error: command 'cc' failed with exit status 1 的解决方法
- python模块安装报错 :error: command 'gcc' failed with exit status 1
- 关于Python安装模块出现error: command 'gcc' failed with exit status 1错误的解决方法
- 安装python模块时出现:error: Setup script exited with error: command 'gcc' failed with exit status 1
- error: command 'gcc' failed with exit status 1 的解决办法
- error: command 'gcc' failed with exit status 1 的解决办法
- error: command 'gcc' failed with exit status 1 的解决办法
- python 安装superset:error: Setup script exited with error: command 'gcc' failed with exit status 1
- CentOS7上 pip install MySQL-python 安装失败(error: command 'gcc' failed with exit status 1)的解决办法
- 【解决方法】Setup script exited with error: command 'cc' failed with exit status 1
- 安装MySQL-python时发生错误:error: command 'gcc' failed with exit status 1
- 安装MySQL-python时发生错误:error: command 'gcc' failed with exit status 1
- python 安装报错:【centos】 error: command 'gcc' failed with exit status 1
- [CentOS]安装MySQL-python,error: Setup script exited with error: command 'gcc' failed with exit status
- 解决Python扩展程序编译安装的error: command 'mt.exe' failed with exit status 31
- error: command 'gcc' failed with exit status 1
- error: command 'gcc' failed with exit status 1
- 做什么运动可以排毒养颜
- 关于VC++的增量链接(Incremental Linking)
- IOS didReceiveMemoryWarning 的那些事
- 2014年4月操作系统份额:Windows XP仍然在26%以上,Linux微涨
- C#用委托调用C++写的dll里面的函数指针
- MAC安装python模块碰到“error: command 'cc' failed with exit status 1”解决办法
- 关于“To be, or not to be”的一个小话题
- 20140505收盘小结
- Eclipse快捷键功能
- 车祸是怎么发生的 不论你是否开车都该看看!
- nginx配置状态监测
- windows server 2008 iis和ftp服务器搭建
- NETGEAR为深圳华强电子世界构云时代办公信息化
- 被误读的丰田生产方式