Compiling Python 2.4 Extensions With Microsoft VC Toolkit 2003

For people looking for a way to compile extensions for Python 2.4, there’s this page with some instructions on the bits needed.

Contrary to what the page says though, you don’t need to hack your distutils install to get it to work. You just need to provide the registry keys that distutils is looking for.

To do so, you can create a simple .reg file with the right values for your machine and double-click it. Here’s what it should look like for an English install:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\VC]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\VC\VC_OBJECTS_PLATFORM_INFO]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\VC\VC_OBJECTS_PLATFORM_INFO\Win32]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directories] “Path Dirs”=”C:\\Program Files\\Microsoft Visual C++ Toolkit 2003\\bin;C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\bin”
“Library Dirs”=”C:\\Program Files\\Microsoft Visual C++ Toolkit 2003\\lib;C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Lib;C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\lib”
“Include Dirs”=”C:\\Program Files\\Microsoft Visual C++ Toolkit 2003\\include;C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Include”

Alternatively, you can just download this file instead, or this other one for a Brazilian Portuguese install.

The bad news is that the Visual C++ ToolKit 2003 doesn’t seem to be available from the Microsoft Downloads anymore, so you might have a hard time finding it.

I still need to give a run to the Visual C++ 2005 Express Edition, but best I can tell it won’t work unless you also compile Python with it. There are clues that it won’t work at all though. At least not with some tinkering.