我在Windows系统上使用Python 2.6和cx_Freeze 4.1.2。我创建了setup.py来构建我的可执行文件,一切正常。
当cxúu Freeze运行时,它会将所有内容移动到build
目录。我还有一些其他文件想包含在我的build
目录中。我该怎么做?这是我的结构:
src\
setup.py
janitor.py
README.txt
CHNAGELOG.txt
helpers\
uncompress\
unRAR.exe
unzip.exe
这是我的片段:
setup
( name='Janitor', version='1.0', description='Janitor', author='John Doe', author_email='john.doe@gmail.com', url='http://www.this-page-intentionally-left-blank.org/', data_files = [ ('helpers\uncompress', ['helpers\uncompress\unzip.exe']), ('helpers\uncompress', ['helpers\uncompress\unRAR.exe']), ('', ['README.txt']) ], executables = [ Executable\ ( 'janitor.py', #initScript ) ] )
我好像没法让它工作。我需要一个MANIFEST.in
文件吗?
有一个更复杂的例子在:cx_freeze - wxPyWiki
缺少所有选项的文档位于:cx_Freeze (Internet Archive)
但是,使用
cx_Freeze
时,与使用Py2Exe
不同,我仍然可以在单个文件夹中获得11个文件的生成输出。备选方案:Packaging | The Mouse Vs. Python
要查找附加文件(
include_files = [-> your attached files <-]
),应在setup.py代码中插入以下函数:See cx-freeze: using data files
明白了。
注:
include_files
必须包含指向setup.py
脚本的“唯一”相对路径,否则生成将失败。include_files
可以是一个字符串列表,即具有相对路径的一组文件或
include_files
可以是元组列表,其中元组的前半部分是具有绝对路径的文件名,后半部分是具有绝对路径的目标文件名。(当缺少文件时,请咨询青蛙克米特)
相关问题 更多 >
编程相关推荐