源码安装:
点击这里下载源码
解压前线装一下必要的包
代码语言:javascript复制 yum install python-devel mysql-devel zlib-devel openssl-devel
解压
代码语言:javascript复制 tar xf MySQL-python-1.2.3.tar.gz
cd MySQL-python-1.2.3
修改mysite.cfg,指定mysql-config的路径
使用whereis mysql-config
找路径
vi mysite.cfg
#找到mysql_config = XXX
改为你的路径
继续安装
代码语言:javascript复制 python setup.py build
python setup.py install
工具安装:
代码语言:javascript复制sudo easy_install mysql-python
sudo pip install mysql-python
代码语言:javascript复制出现错误的解决办法
---
vi ~/.bash_profile
add
export DYLD_LIBRARY_PATH='/usr/local/mysql/lib'; PATH="$PATH:/usr/local/mysql/bin"
代码语言:javascript复制enjoy~
Win下请直接下载编译好的安装包:
[请输入链接描述][2]
[1]: http://sourceforge.net/projects/mysql-python/files/mysql-python/