I'm using py2exe to compile my script into an exe file to run on Windows, but I'm hitting errors based on my OS, which is Window 7 x64. I'm running the below script in cmd using execmaker.py py2exe
:
from distutils.core import setup
import py2exe
includes = []
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
'Tkconstants', 'Tkinter']
packages = []
dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll',
'tk84.dll']
setup(
options = {"py2exe": {"compressed": 2,
"optimize": 2,
"includes": includes,
"excludes": excludes,
"packages": packages,
"dll_excludes": dll_excludes,
"bundle_files": 1,
"dist_dir": "dist",
"xref": False,
"skip_archive": False,
"ascii": False,
"custom_boot_script": '',
}
},
windows=['My_Script.py'] #this is the name of the script I'm compiling to exe
)
The actual script I'm compiling into exe isn't important, because it worked completely fine when I compiled it using bundle_files: 3,
which doesn't bundle any of the files and leaves ~200 .pyo files in a folder.
So let's get to the center of the problem: As I'm on Win 7 x64, I have the 64-bit version of Python 2.7.5 installed. When I cd
down to the file where the execmaker.py
and the My_Script.py
files are and run it in cmd (execmaker.py py2exe
), I get an error message that reads as follows:
error: bundle-files 1 is not yet supported on win64
, which I take to mean that it won't bundle the files because my OS is 64-bit. I thought that maybe this was a problem created because I have 64-bit python installed, but when I uninstalled it, I received the error DLL load failed: %1 is not a valid Win32 application.
The DLL Load error is caused by running 32-bit python on 64-bit Windows. So basically, it doesn't work with 32-bit or 64-bit python because I'm running 64-bit Windows. Is there a workaround for this, or do I need to install python and all the modules I've been using on a 32 bit machine to do the compiling?
Thank you for the help, and for bearing with me through this very long question.
Edit - Solution: I did some more research and came up with nothing. For now, unless this question is answered with something more efficient, I guess installing a 32-bit operating system on a partition or through Parallels (which is how I did it) will have to suffice.
I guess it is too late for you now but for the next soul stuck in this boat, in my opinion, a more efficient way would be to install virtualbox (vb) for free from oracle and then install your 32 bit os on it. That way you don't have to partition your hard drive or what not, and you can without any risk uninstall the vb just like any other program.
Another option would be to try to work with pyinstaller. I have only used it to make executables for linux systems but I think you can use it on windows too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With