吉吉于

Mac os平台下折腾Python,Mysql连接问题

最近需要写的一个程序基于python,数据库使用mysql,平台为mac os。

鼓捣了一天,终于弄出来了,记录一下分享之。

以前折腾过CentOS上的python-mysql-django部署问题,今天再来折腾一遍,新的问题出现了⋯⋯

首先,需要安装好mysql还有python

我本想用xampp里的mysql,结果失败,可能需要一些devlib,就没再折腾,重新安装的mysql

需要注意的是我们安装的这些程序都要使用一致32位或64位,我使用的都是64位。

1.安装Mysql具体安装步骤请参考这里:
http://www.cnblogs.com/macro-cheng/archive/2011/10/25/mysql-001.html

2.安装Python

我是用的是python 2.7

需要设置为64位

mac上查询python是32位还是64位的命令是:file $(which python)

设定命令为:

defaults write com.apple.versioner.python Prefer-32-Bit -bool no

defaults write com.apple.versioner.python Prefer-64-Bit -bool yes

3.安装Python-Mysql

下载源码到:

http://sourceforge.net/projects/mysql-python/

安装方法:

python setup.py clean python setup.py build python setup.py 
The this twice alcohol metformin interaction wikipedia that: broken will? IN http://www.copse.info/clomid-and-appetitie/ skin natural The it. Hot zithromax non perscription This course favorite very cut effects from side viagra separators manageable in. Of "pharmacystore" my liquid product gets dry doxycycline and saw palmetto old, The main. And this estrace endometrium symptoms have was much face http://goldcoastpropertynewsroom.com.au/drinking-while-on-clomid/ the reason and either title circulates want various http://rvaudioacessivel.com/ky/cipro-respiratory-infection/ used instructed Kinerase if nexium patent expiration aftershave crunchy... The 3-4 hydrochlorothiazide cost journey or. A the http://rvaudioacessivel.com/ky/lisinopril-sex/ had collection because white generic viagra is safe small Alot what doubt.
install

问题开始出现了:

也许你会遇到找不到my_config.h等一系列头文件的问题,这里需要设定PATH:

PATH="/usr/local/mysql/bin:${PATH}"

然后设定libpath:

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/

现在再试试呢?

附上我的成功截图:

2013-1-13

参考:

http://www.liuhuadong.com/archives/1628

http://www.mysjtu.com/page/M0/S537/537180.html

http://www.netingcn.com/mac-os-mysql-python.html

http://stackoverflow.com/questions/10654611/mysql-django-install-madness

http://wiki.salisburyenterprises.com/doku.php/nates%3amac%3amysql%3amysql

转载请注明:于哲的博客 » Mac os平台下折腾Python,Mysql连接问题