Compiling mysql-python on Windows


, , , , , , ,

To compile mysql-python on Windows you need latest Windows SDK and free Visual C++ 2008 Express Edition or its commercial relative. Python setup script needs few fixes – open setup-windows.py and make following changes:

else:
    #client = "mysqlclient"
    client = "libmysql"
 
library_dirs = [ os.path.join(mysql_root, r'lib\opt') ]
libraries = [ 'kernel32', 'advapi32', 'wsock32', 'msvcrt', client ]

Make sure you have libmysql.lib available and VC++ 2008 redistributables installed. Now module should compile without problems.