1、首先确保Windows下已经安装Python、Eclipse并且Eclipse已经集成Pydev能成功运行Python
2、下载MySQL-python
根据自己的系统和安装的Python版本选择MySQL-python的版本
我的系统版本是Windows 8 64bit Python是2.7.6
下载完成以后双击安装即可,如果提示找不到python,请确保版本和环境一致
3、打开eclipse,选择Windows--Preferences--Pydev--Interpreter - Python
4、点击Libraries -- New Folder -- 找到MySQLdb的安装目录,一般在python安装目录下的site-packages下的MySQLdb,选择这个目录 -- 点击Apply -- 如果出现提示框,选择Select ALL -- OK
5、点击Forced Builtins -- 输入MySQLdb -- OK -- 然后点击Apply -- 如果出现提示框,选择Select ALL -- OK
6、重启Eclipse,import MySQLdb即可
原文:http://duxiansheng.blog.51cto.com/11062970/1836153