0

I'm working to take several scripts I've written and create both Mac applications and Windows executables using py2app and py2exe, respectively. I'm doing the Mac work on my own machine and have encountered no problems. For Windows, I'm forced to access my school's computer via Remote Desktop. There I'm using IDLE with Python 3.8 on Windows 10. All python packages are installed by my system administrator.

py2exe has been installed as the picture below shows:

enter image description here

I'm able to import py2exe at the IDLE shell and import it inside scripts. However, when I try to follow the tutorial at https://www.py2exe.org/index.cgi/Tutorial#Step2 and run the "hello world" example, I encounter a problem. My setup is as shown there:

from distutils.core import setup
import py2exe 
setup(console=['hello.py'])

At the command prompt, I type

python setup.py py2exe

But I receive the "ModuleNotFoundError: No module named 'py2exe' found" error message.

fishbacp
  • 1,123
  • 3
  • 14
  • 29

2 Answers2

1

Uninstall python-3.8 and install python-3.4 to get py2exe working. Or use the python-module virtualenv to keep both versions. Here is my answer with code on using virtualenv to get py2exe or pyinstaller working.

0

Don't import py2exe in the code

Delete
#import py2exe

if you want to create exe, go to cmd and $py2exe

Vignesh
  • 1,553
  • 1
  • 10
  • 25
  • I'm not sure I understand. I've deleted the import command from my setup file as you suggest. At the prompt, trying both of the following results in error messages: $py2exe. (yields unrecognized command) python setup.py $py2exe (yields invalid command) If you look at the setup file in the tutorial, you'll see py2exe is imported there. – fishbacp Jun 27 '20 at 15:18
  • use pyinstaller instead, https://pyinstaller.readthedocs.io/en/stable/usage.html – Vignesh Jun 27 '20 at 15:21