1、首先确保Windows下已经安装Python、Eclipse并且Eclipse已经集成Pydev能成功运行Python

 

2、下载MySQL-python

   地址:http://www.codegood.com/downloads

   根据自己的系统和安装的Python版本选择MySQL-python的版本

   我的系统版本是Windows 8 64bit  Python是2.7.6

   所以我下载的是MySQL-python-1.2.3.win-amd64-py2.7.exe

   下载完成以后双击安装即可,如果提示找不到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即可 

posted on 2017-09-08 17:35  杜先生的博客  阅读(459)  评论(0编辑  收藏  举报