MySQL-5.1.34 Python-2.6 Module Build Instructions
From BC's PCs Wiki
Prerequisites:
1) Get MySQL-Python module source:
2) Install Python's setuptools module:
- Download these two files and put them into the same directory:
- Open a command prompt in this directory and type "python ez_setup.py setuptools-0.6c9-py2.6.egg"
3) Build MySQL-Python module:
- If you are using Visual Studio 2005, tweak environment:
- make sure "vsvars32.bat" exists in "C:\Program Files\Microsoft Visual Studio 8\Common7\Tools"
- create the environmental variable "VS90COMNTOOLS" with the value "C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\"
- Restart PC
- Edit "MySQL-python-1.2.2/ez_setup.py" file:
- Edit "MySQL-python-1.2.2/site.cfg" file:
- Edit "MySQL-python-1.2.2/_mysql.c" file:
- On or around line 31 you will find this:
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) || defined(MS_WIN32)
#include <windows.h>
- Change it to this:
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) || defined(MS_WIN32)
#include <winsock2.h>
#include <windows.h>
- Open command prompt in MySQL-python-1.2.2 folder
- Type "setup.py build"
- Note: You will probably get a bunch of warnings and maybe a manifest error, these are ok as long as there are no errors in compiling or linking.
- Note: This will generate the "MySQL-python-1.2.2/build" folder
- Type "setup.py bdist_wininst"
- Note: This will generate the "MySQL-python-1.2.2/dist" folder
4) Install MySQL-Python module:
- Execute "MySQL-python-1.2.2/dist/MySQL-python-1.2.2.win32-py2.6.exe"