Main Pages
Win32 Extensions
Microsoft .NET
Windows CE
Python Home
Official Windows Home
Python documentation
Starship Windows Links
Roger Burnham
Gordon McMillan/Win32 Installer
Ken Seehof
Bill Wilkinson/MSAccess and Python
Other Links
Python and ADO
Paul Boddie's Python COM tutorial
Chris Phoenix's Pythonwin tutorial
win32com script collection
Email me


Building the Windows Extensions from sources

A few of you have no doubt struggled immensely when attempting to build the Win32 Extensions for Python. So have I :-) Here is my current best effort at documentation for this. The sources are available from the downloads page (or the downloads directory).

Building the extensions.

These extensions are now built using distutils. in the root of the source tree is the distutils script to use.  You will require Microsoft Visual C++ version 6 (for Python 2.2 and 2.3) or Microsoft Visual C++ 7 (for Python 2.4 and later).  These extensions no longer build with older Python versions.

For detailed instructions on how to build the extensions, run without any parameters.

Compiler Considerations

Keeping all the various SDKs in place to build all the extensions can be a challenge.  Visual C++ 6 is quite old now, and some of these extensions rely of features not available in the standard MSVC headers and libraries.  In this case, the distutils script will still try and build as many extensions as possible, but to get them all built you will require some additional downloads.

In general, you should also install the latest Microsoft Platform SDK - this will give you the latest headers and libraries, regardless of your MSVC version.

  • Recent win32security updates from Roger Upole require a fairly recent Platform SDK
  • To build the ActiveScripting projects, you will also need to "Internet Development SDK".  To build ActiveDebugging, you will need an SDK from Microsoft (who's location keep changing - search MSDN downloads for the exact phrase Microsoft Script Debugger

MSVC6 Project files, and different Python versions

This doesn't apply for distutils based builds.  However, if you still build from the MSVC6 project files in the tree, there is some magic you must perform to get each Python version built.

In general, the source code works with all Python versions.  However, the project files for building PyWinTypes1x.dll and PythonCOM1x.dll are necessarily different between the two versions, as the output filename is different.  CVS tags are applied to these files - a Python 2.1 build uses the tag "Python21", and so forth, with the current CVS Python version being on the head.  Thus:

cvs -z3 update -r Python21 com/win32com.dsp win32/PyWinTypes.dsp

will configure everything for a Python 2.1 build.  Also see the .bat files in the main source directory which will assist in building for different versions.

Most win32all builds are also tagged (eg, build 135 is tagged as "b135").  This should allow you to recreate an exact build.

COM Extension modules

Many of the COM extension modules (eg, axscript.pyd, mapi.pyd) will not work after you build them - this is because they are built into the com\build directory, but all Python code assumes they exist in their respective directory (eg, win32comext\axscript or win32comext\mapi).  You have 2 choices:

Move the .pyd files to their respective directories

Add a registry key SOFTWARE\Python\PythonCore\1.5\PythonPath\win32com\BuildPath, and set the value to the directory where the .pyd's are built.  win32com\ has special support for this key specifically for developers.

[Wed Jul 27 08:02:53 2005 GMT+10]