首先会出现如下错误:
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