Armster
Armster

Reputation: 889

py2exe - Create a single exe with all files/resources embedded in the exe

I want to create an exe in py2exe with all the files my python program is dependent on and embed them into the exe and still have a single exe with no additional files. How can I do this?

edit: py2exe can generate a single executable but it doesn't put the data files in the exe.

Upvotes: 0

Views: 2644

Answers (1)

Jeff
Jeff

Reputation: 57

Create a file named setup.py with the following and place it in the same folder as myscript.py.

from distutils.core import setup
import py2exe
import sip
setup(options={'py2exe':{'bundle_files': 1, 'compressed': True}}, 
    windows=['myscript.py'], zipfile = None)

From a Command Prompt run:

setup.py py2exe

Upvotes: 1

Related Questions