Skip to content
davispuh edited this page Apr 12, 2013 · 5 revisions

Requirements

* can use compilers and libraries from Visual Studio (or Visual C++) then SDK is not required as VS comes with it. (or any other compiler, ie. MinGW, but that isn't covered here)

Warning

Visual Studio Express and Visual C++ Express doesn't come with x64 compliers so if you're using x64 python you wont be able to compile for it.

Step by step

  1. Install Python 3
  2. Optionally add python to PATH or if you've multiple versions you can set it temporarily for that command-line. Also alternatively you can write full path.
  3. Check if python works (Note. python (python.exe) refers to Python 3)
  4. Install distribute.
  5. Install MySQL Server. I suggest use MSI Installer, but it's also possible to use ZIP Archive if you don't want to install server, but just compile lib.
  6. Install Microsoft .NET Framework
  7. Install Microsoft Windows SDK. Make sure you check "Visual C++ Compilers" and "Windows Headers and Libraries" (under Windows Native Code Development)
  8. Download and extract MySQL for Python 3
  9. Open site.cfg with editor which understands LF line endings (ie. WordPad). And change mysql_location to point to MySQL Server root directory. (In case using ZIP Archive to extracted folder)
  10. Navigate to Start Menu -> Microsoft Windows SDK and run Windows SDK Command Prompt (or Developer Command Prompt)
  11. If you haven't put python in PATH you can temporary set it with set PATH=location\to\python\;%PATH% (or you can edit win_build.cmd with full path to python)
  12. Now finally install it by launching win_build in opened command-line.
  13. You can test if it was successfully installed by opening python and typing import MySQLdb (it shouldn't say anything if import was successful)

Basic check

  1. start MySQL server (if it's not running)
  2. create test.py with contents from [Usage example](Usage example)
  3. edit settings (root password, etc) accordingly
  4. try it with python test.py
Clone this wiki locally