Home  >  Article  >  Database  >  Mac 上装 Python的SQLdb_MySQL

Mac 上装 Python的SQLdb_MySQL

WBOY
WBOYOriginal
2016-05-31 08:47:081466browse

python

应该是Mac 10.9


然后装的时候,从网上下载

sudo easy_install mysql-python

果断失败了。


接着从网上下载了MySQL-python-1.2.3.tar

其实有1.2.5的版本,但是太新了,不敢用,好像目前也没tar的版本,只有zip的。


解压后,用vim打开site.cfg

有一行#mysql_config = mysql_config = /usr/local/bin/mysql_config

把前面的注释去掉,根据自己电脑mysql实际安装目录填写,如果你一路next的话,应该是下面这样的。

mysql_config = /usr/local/mysql/bin/mysql_config


然后用GCC安装,执行

python setup.py clean

python setup.py build

python setup.py install


但是第二条就出错了。

错误如下:

    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

然后果断查了下SOF,找到了解决的方法:

export CFLAGS=-Qunused-argumentsexport CPPFLAGS=-Qunused-arguments
然后就装好了,折腾了半天,在这里记下来,希望大家也能不走弯路。


安装CJSON遇到了类似的问题,最后还需要 sudo 后面加-E才行。


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn