简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM