Search code examples
pythonpyinstallerpy2exe

PyInstaller/py2exe - OSError: [WinError 193] %1 is not a valid Win32 application


I get this error when running PyInstaller, py2exe, and Auto Py to Exe. I have uninstalled and reinstalled both Python and PyInstaller. My Python version is 3.9.2, 64 bit.

I finished my app, but it doesn't want to become an .exe. I get a slightly different error when using py2exe, as it says error instead of OSError.

Here's what I ran and the result from using py2exe:

PS C:\Users\nstil\Desktop\Coding\MC> python setup.py py2exe
running py2exe
error: [WinError 193] %1 is not a valid Win32 application

Here's setup.py:

from distutils.core import setup
import py2exe

setup(console=['MC.py'])

Solution

  • I ended up uninstalling my Python 3.9.2 (64-bit) and installed the 32-bit version, and it fixed the issue. Although, another issue occurs now.