The cx_Freeze is a tool that packs Python files to generate a EXE file. How do we avoid it generating Library.zip? The following source tree is an example.
[Workspace]
[MyApp]
Setup.py ---- cx_Freeze setup program
MyApp.py ---- the python file that will be packed in EXE.
[build] ---- The directory is generated by cx_Freeze
The content of the Setup.py is:
We perform the following command to pack MyApp.py in MyApp.exe.
Workspace> python MyApp\Setup.py build
You cannot find Library.zip in the build directory because create_shared_zip is assigned to False.
-Count
[Workspace]
[MyApp]
Setup.py ---- cx_Freeze setup program
MyApp.py ---- the python file that will be packed in EXE.
[build] ---- The directory is generated by cx_Freeze
The content of the Setup.py is:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
from cx_Freeze import setup, Executable | |
Exe1 = Executable ( | |
script=r"MyApp\MyApp.py", | |
base=None, | |
appendScriptToExe = True, | |
appendScriptToLibrary = False, | |
) | |
includes = [] | |
excludes = [] | |
packages = [] | |
path = sys.path | |
setup ( | |
name = "MyApp", | |
version = "0.1", | |
description = MyApp, | |
executables = [Exe1], | |
options = { | |
"build_exe": { | |
"includes": includes, | |
"excludes": excludes, | |
"packages": packages, | |
"path": path, | |
"create_shared_zip": False, | |
# don't generate Library.zip | |
"append_script_to_exe": True, | |
# don't generate MyApp.zip file. | |
} | |
} | |
) |
Workspace> python MyApp\Setup.py build
You cannot find Library.zip in the build directory because create_shared_zip is assigned to False.
-Count
No comments:
Post a Comment