Linux环境下MySQL-python安装过程分享
1.首先确认python的版本为2.3.4以上,如果不是需要升级python的版本
python-V 检查python版本
2.安装mysql,比如安装在/usr/local/mysql目录下
3.下载MySQL-python-1.2.2.tar.gz
地址https://sourceforge.net/projects/mysql-python/
4.安装MySQl-python
tarxvzfMySQL-python-1.2.2.tar.gz cdMySQL-python-1.2.2 visite.cfg
把mysql_config=/usr/local/mysql/bin/mysql_config这一行前的#去掉,并且把mysql_config的路径设置正确。
pythonsetup.pybuild sudopythonsetup.pyinstall
安装结束
5.测试
运行:python
importMySQLdb
如果没有报错,说明安装好了。