一个Mac OS X Lion pythonmysql安装配置记录有需要的朋友可参考参考.
Mac OS X Lion自带python 2.7.
1.通过appstore安装Xcode 4.1
2.官方下载mysql for mac x64,mysqlpython;
3.mysql for mac有dmg格式,下载后双击安装;
4.配置/etc/paths,添加/usr/local/mysql/bin;
5.打开终端程序,执行sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
6.解压mysqlpython,打开终端,进行mysqlpython解压目录,执行:
sudo python setup.py build
sudo python setup.py install
7.确认编译安装正确,输入python,进行python命令行,执行以下命令:
- >>>importMySQLdb
- >>>MySQLdb.__version__
- ’1.2.3′
- >>>
8.如能返回pythonmysql版本,说明安装成功.