Compiling MySQLdb 1.2.3 on Windows 32 and 64 – Without need the MySQL Database 5.5 installed
If you wish the module already compiled, access here:
First Thing: Follow this main steps to prepare the pre-requirements for compile this module:
1 – Compiling MySQLdb 1.2.3 for Mysql 5.5 database
1.1 – You will need to download the latest version of MySQL Connector C here: http://dev.mysql.com/downloads/connector/c/
* Important: Make the download properly for your platform (32 or 64 bits).
1.2 – Make the download of MySQLdb plugin here and extract to any folder: http://sourceforge.net/projects/mysql-python/
1.3 – Edit this file (MySQL-python-1.2.3/setup_windows.py) inside of folder extracted:
At Line 7 of the file, comment the two follow lines and add another, like this:
#serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key']) #mysql_root, dummy = _winreg.QueryValueEx(serverKey,'Location') mysql_root = ''
At Line 19, put the path to your Connector C installed:
library_dirs = [ os.path.join(mysql_root, r'lib\opt'), 'C:\Program Files\MySQL\MySQL Connector C 6.0.2\lib\opt' ] libraries = [ 'kernel32', 'advapi32', 'wsock32', client ] include_dirs = [ os.path.join(mysql_root, r'include'), 'C:\Program Files\MySQL\MySQL Connector C 6.0.2\include' ] extra_compile_args = [ '/Zl' ]
Important: Specify the correct path for your platform (32 or 64 bits). Above the platform is 64 bits, to 32 bits use this path: “C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2”.
1.4 – Make the build:
python setup.py build --compiler msvc python setup.py bdist_wininst
It’s finish.
The advantage os this technique an a comparison with others posts is:
1 – The MySQL Database is not required on machine (only the connector c)
2 – Not is necessary make the update on the windows registry:
# The Windows registry key for MySQL. # This has to be set for Windows builds to work. # Only change this if you have a different version. registry_key = SOFTWARE\MySQL AB\MySQL Server 5.0
Credits and References to this post:
Bye,
Victor Jabur