Monthly Archives: September 2009

MySQL and Python 2.6 on Windows, Redux

As I noted before, getting a version of MySQLdb that works for Python 2.6 on Windows is an exercise in frustration.  Until now.

An anonymous commenter on the previous post pointed to a web page with instructions for compiling MySQLdb with Visual Studio.  This was quite the salvation to me as I have no experience with Visual Studio or really any sort of compiling on Windows at all.

The only thing lacking in those instructions is the bit about “vsvars32.bat”.  It says:

make sure “vsvars32.bat” exists in “C:\Program Files\Microsoft Visual Studio 8\Common7\Tools”

That’s the last mention of that file.  The problem is that you have to actually run that batch file prior to compiling.

The only other adjustments I had to make were to account for the fact that I’m using Visual Studio 2008 which has a different path than Visual Studio 2005.

All that resulted in my own Windows installer for MySQLdb for Python 2.6.  This was compiled on Windows 7 64-bit, I’m not sure how it’ll work on other operating systems, but if it doesn’t work for you make a comment and I’ll see if I can compile a version for your environment.

Download it here.