centos下安装python MySQLdb
源码安装:
点击这里下载源码
解压前线装一下必要的包
yum install python-devel mysql-devel zlib-devel openssl-devel
解压
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
改为你的路径
继续安装
python setup.py build
python setup.py install
工具安装:
sudo easy_install mysql-python
sudo pip install mysql-python
出现错误的解决办法
---
```bash
vi ~/.bash_profile
# add
export DYLD_LIBRARY_PATH='/usr/local/mysql/lib';
PATH="$PATH:/usr/local/mysql/bin"
enjoy~
Win下请直接下载编译好的安装包: