ubunut14.04
python2.7安装MySQLdb,3.x的版本安装PyMySQL
1、source python_env/bin/activate --**virtualenv虚拟环境
2、sudo apt-get install libmysqlclient-dev libmysqld-dev
3、sudo apt-get install python-dev
4、pip install MySQL-python==1.2.5
4、验证安装是否成功
1、python 进入python环境
2、import MySQLdb
3、quit() 退出pyhton环境
---------------------------------华丽分割线----------------------------------
Ubuntu16.04安装MySQL-python
下载mysql-server_5.7.17-1ubuntu16.04_amd64.deb-bundle.tar并解压
按顺序执行
sudo dpkg -i mysql-common_5.7.17-1ubuntu16.04_amd64.deb
sudo dpkg -i libmysqlclient20_5.7.17-1ubuntu16.04_amd64.deb
sudo dpkg -i libmysqlclient-dev_5.7.17-1ubuntu16.04_amd64.deb
sudo dpkg -i libmysqld-dev_5.7.17-1ubuntu16.04_amd64.deb
sudo dpkg -i libaio1_0.3.110-1_amd64.deb 缺少这个包,下载这个包
sudo dpkg -i mysql-community-client_5.7.17-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-client_5.7.17-1ubuntu16.04_amd64.deb
转载于:https://blog.51cto.com/xiaok007/1906205