Dev-Picayune

picayune: of little value or importance

Building Python 2.6 executables for Windows

I finally made a build of my game, Raven Checkers, on Windows XP. In the process I ran into the same issues as everyone else with Python 2.6 and the new requirement for manifest files. Since Python 2.6 binaries for Windows are now compiled using Visual Studio 2008, a manifest file is required both for your own executable and for the C runtime that Python uses. I was not able to find a simple step-by-step process on how to do this, so here’s how I do it.

  1. Make sure that Python 2.6 is installed on your system with the “Install just for me” option during setup. This ensures that the DLLs and manifest files that you will need will be placed into the Python26 directory where you can easily locate them later.
  2. Build an executable of your program for Windows. I’m using gui2exe (0.3) and py2exe (0.6.9) to make it simple. I set the Bundle Files option to 2, and the Compression option to 0. Why, do you ask? I am unable to get any other combination of options to work properly. If you can, more power to you. I also use the option to create a dist directory called, um, ‘dist’.
  3. From the Python26 directory, copy msvcr90.dll, Microsoft.VC90.CRT.manifest, and python.exe.manifest over to your dist folder.
  4. Rename the python.exe.manifest file to [yourappname].exe.manifest.

Now you should be able to copy your dist folder over to a clean Windows machine, double-click on your executable and have it start without any side-by-side configuration issues.

By the way, If you don’t have a clean Windows machine to test on your app on, the easy and free solution is to download Microsoft Virtual PC 2007 and a free XP or Vista virtual machine image. Once VPC is installed, you can copy your files to your virtual machine by simply dragging them from your dev machine desktop onto the VPC desktop window.

Here’s to Windows deployment and testing made (relatively) simple! Hope this saves you some hours of Googling.

No comments

No comments yet. Be the first.

Leave a reply