Reputation: 25928
I am aware how to convert a Python script to an Windows Executable file(.exe) using Py2Exe, PyInstaller and etc.
But is there a way to convert a Python script to an .exe that will work on all the following versions of Windows: Windows XP to Windows 8?
Keep in mind my Python script is very simple and does NOT use any libraries like pyGTK or wxPython. Its just a simple console script that lists all files in a directory and writes it to a file.
So if I were to compile the following script using Py2Exe on my Windows 7 64bit computer, would that .exe work on ALL the following versions of Windows: Windows XP to Windows 8? I am hoping I wont need to create a 32bit version then a 64bit version.
import os
def main():
#TODO: get command line arguments
files = listdir("\")
out = open('outfile.txt', 'w')
out.write(files)
out.close()
main()
Upvotes: 1
Views: 5799
Reputation: 847
I roll up my wxPython-based app using PyInstaller on Windows Vista/32. After building the executable, I roll that into an installer using InnoSetup. I have customers running everything from XP to 8 in both 32 and 64-bit modes from the same setup executable made in this fashion.
I'm considering building 64-bit versions but so far nobody's asked for it and it hasn't seemed necessary.
I've tried py2exe, cxFreeze, and PyInstaller on Windows, and so far PyInstaller is my favorite. I ran into issues with py2exe on some platforms; cxFreeze at the time couldn't handle putting in version resources (it can now) and PyInstaller seemed to "just work" the quickest right out of the box.
So to cut to the chase, no you don't need to build both 32-bit and 64-bit versions of your app, if you don't care that on 64-bit Windows it'll run in 32-bit mode through the WOW virtual machine.
Upvotes: 4
Reputation: 34527
Your best bet is to create on the lowest system you want to support. IT should then be forward compatible. 32bit will run on 64bit Windows just fine.
Upvotes: 1