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.

Advertisement

2 thoughts on “Compiling Python 2.4 extensions with Microsoft VC Toolkit 2003

  1. There are no problems running a standard python distribution with extensions compiled with VC++ 2005 Express. Been doing it for days without any problems…

    (The down side is that distutils doesn’t directly support it atm.)

    Alex

  2. Thanks for the info, I have been attempting to compile an MQ python extension under Windows with no luck. Your hack did the trick…thankfully I happened to have a copy of the 2003 toolkit around. Also, VS 2005 (I have the full version) doesn’t work at least not for the extension I am interested in.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.