-
Notifications
You must be signed in to change notification settings - Fork 45
Install on Windows
davispuh edited this page Apr 12, 2013
·
5 revisions
- Python 3
- distribute
- MySQL Server (specifically MySQL headers and libraries)
- "Visual C++ Compilers" and "Windows Headers and Libraries" from Microsoft Windows SDK*
- Microsoft .NET Framework* (Required for SDK)
- MySQL for Python 3
* 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)
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.
- Install Python 3
- 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.
- Check if
python
works (Note.python
(python.exe
) refers to Python 3) - Install distribute.
- 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.
- Install Microsoft .NET Framework
- Install Microsoft Windows SDK. Make sure you check "Visual C++ Compilers" and "Windows Headers and Libraries" (under Windows Native Code Development)
- Download and extract MySQL for Python 3
- Open
site.cfg
with editor which understands LF line endings (ie. WordPad). And changemysql_location
to point to MySQL Server root directory. (In case using ZIP Archive to extracted folder) - Navigate to
Start Menu -> Microsoft Windows SDK
and runWindows SDK Command Prompt
(orDeveloper Command Prompt
) - If you haven't put python in PATH you can temporary set it with
set PATH=location\to\python\;%PATH%
(or you can editwin_build.cmd
with full path to python) - Now finally install it by launching
win_build
in opened command-line. - You can test if it was successfully installed by opening python and typing
import MySQLdb
(it shouldn't say anything if import was successful)
- start MySQL server (if it's not running)
- create
test.py
with contents from [Usage example](Usage example) - edit settings (root password, etc) accordingly
- try it with
python test.py