mal*_*esh 4 python exe build cx-freeze python-3.x
有一个示例使用一个py文件(模块)构建可执行文件,这里给出我有大约4个py文件(模块),我想构建可执行文件,其中应包含所有py文件.
当我们有多个python模块时,如何构建python可执行文件?
这里的例子
from cx_Freeze import setup, Executable
setup(
name = "hello",
version = "0.1",
description = "the typical 'Hello, world!' script",
executables = [Executable("hello.py")])
Run Code Online (Sandbox Code Playgroud)
如果我有两个文件,如hello1.py和hello2.py,这有hello.py吗?
谢谢
小智 5
如果您的hello.py文件导入这些文件 - hello1.py然后hello2.py,这一行:
executables = [Executable("hello.py")])
Run Code Online (Sandbox Code Playgroud)
够了.
但是如果这些文件中的任何一个是单独的脚本文件,那么你应该这样做:
from cx_Freeze import setup, Executable
setup(
name = "hello",
version = "0.1",
description = "the typical 'Hello, world!' script",
executables = [Executable("hello.py"), Executable("hello1.py"), Executable("hello2.py")]
)
Run Code Online (Sandbox Code Playgroud)
它将.exe为每个脚本创建3个文件.
| 归档时间: |
|
| 查看次数: |
3432 次 |
| 最近记录: |