当前位置:Gxlcms > mysql > Mac上装Python的SQLdb_MySQL

Mac上装Python的SQLdb_MySQL

时间:2021-07-01 10:21:17 帮助过:5人阅读

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才行。

人气教程排行