本文主要是介绍mac 安装mysqldb,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1:肯定要先安装mysql
2:ln -s /usr/local/Cellar/mysql/5.6.16/bin/mysql_config /usr/local/bin/mysql_config
3:下载MySQL-python-1.2.4b4.tar
4:解压后里面有个文件setup_posix.py,修改mysql_config.path路径
mysql_config.path = "/usr/local/bin/mysql_config"
5:sudo python setup.py install
ERROR:
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
6:
经过一系列的查找: 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
(此段来源URL:http://www.tuicool.com/articles/jaM7Bf)
这篇关于mac 安装mysqldb的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!