Search code examples
pythonpy2exe

How to resolve WinError 87 running py2exe on Win 10


Even my test case is exhibiting this error.

Contents of test.py are:

print("Hello World")

setup2.py is:

from distutils.core import setup
import py2exe

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

When I run cmd as administrator and attempt to run 'python setup2.py py2exe' I get the following:

>python setup2.py py2exe
running py2exe

  2 missing Modules
  ------------------
? _posixshmem                         imported from multiprocessing.resource_tracker, multiprocessing.shared_memory
? readline                            imported from cmd, code, pdb
Building 'dist\test.exe'.
error: [WinError 87] The parameter is incorrect.

Build environment is: Windows 10 Version 20H2 with all the latest updates Python 3.8.6 py2exe 0.10.4.0

Any ideas on how to resolve this error?

I've seen one clue that it has something to do with unicode characters and was solved with simpleprint but am unsure how to implement that


Solution

  • I believe I've actually stumbled on a better solution. I was able to get py2exe to work correctly on both versions of Windows 10 by installing from the downloaded installer from Python.org.

    When using a Python install from the Windows Store, that was when I was encountering the issue. Using Python from an installer, and it seems to work