【发布时间】:2017-02-02 21:49:33
【问题描述】:
所有 cx_Freeze 示例都针对一个文件(模块)。我需要为整个 python 包制作一个可执行文件。为什么这么难做?
这是我的目录:
test1/
__init__
__main__
我从命令行运行它的方式是使用以下 cmd
python -m test1
__init__ 是空的,__main__ 只需要一个简单的print 语句。
我正在使用 python 3.5.1,但如果可以解决问题,我可以切换到 python 3.4
这是我的setup.py win64
from cx_Freeze import setup, Executable
import sys
build_exe_options = {"packages": ['test1'],
"include_files": []
}
executables = [
Executable("__main__")
]
setup(
name = "Foo",
version = "0.1",
description = "Help please!",
author = "me",
options = {"build_exe": build_exe_options},
executables = executables
)
更新: 1-有关此方法的解决方案,请参阅下面的评论 2-切换到pyinstaller,因为它可以生成一个exe文件而不是文件夹
【问题讨论】:
标签: python windows python-3.x executable cx-freeze