首先下载mysql安装文件,官网上下载太麻烦了,直接去天空软件站下载:
http://www.skycn.com/soft/1262.html
注意安装的时候选择Custom选项,然后把C Include Files/Lib Files选中,因为后面build时需要
然后下载MySQLdb
http://sourceforge.net/projects/mysql-python/files/
解压缩到一个文件夹中,然后开始安装
首先安装 easy_install
python ez_install.py
然后build MySQLdb
python setup.py build
出现错误1:
serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key']) WindowsError: [Error 2]
解决方法:
打开MySQL-python-1.2.3/site.cfg文件,将最后一行的5.0修改为5.1,如下所示:
registry_key = SOFTWARE\MySQL AB\MySQL Server 5.1重新python setup.py build
出现错误2:
build\temp.win32-2.6\Release\_mysql.pyd.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified.
error: command ‘mt.exe’ failed with exit status 31
解决方法:
打开 C:\Python26\Lib\distutils\msvc9compiler.py
找到这一行 ld_args.append(‘/MANIFESTFILE:’ + temp_manifest)
然后在下面加入一行 ld_args.append(‘/MANIFEST’)重新python setup.py build成功
最后执行
python setup.py install
成功googlecode 上有别人编译好的exe程序,也许能用