11
我正在使用cx_freeze来部署我的应用程序。我想包括一个完整的目录,因为包括单个文件不会将它们放在一个文件夹中。我怎样才能包含一个文件夹?如何使用cx_freeze包含文件夹?
我正在使用cx_freeze来部署我的应用程序。我想包括一个完整的目录,因为包括单个文件不会将它们放在一个文件夹中。我怎样才能包含一个文件夹?如何使用cx_freeze包含文件夹?
您必须为建筑选项设置包含文件参数。你可以用不同的方式做到这一点,但我会展示我的配置的一部分。我在这里描述的是一个特定的文件和一个特定的目的地。我想你也可以设置这样的路径,但我还没有测试过。
编辑:经过测试,所以选择适合您项目的方法。
buildOptions = dict(include_files = [(absolute_path_to_your_file,'final_filename')]) #single file, absolute path.
buildOptions = dict(include_files = ['your_folder/']) #folder,relative path. Use tuple like in the single file to set a absolute path.
setup(
name = "appname",
version = "1.0",
description = "description",
author = "your name",
options = dict(build_exe = buildOptions),
executables = executables)
再看看这个话题。它提出了相同的问题:How can i bundle other files when using cx_freeze?
我看不到如何设置路径? – PascalVKooten 2013-03-29 19:36:01
您必须将absolute_path_to_your_file替换为您要包含的源文件的目标。在基于Windows的系统上,绝对路径大部分是这样的:“C:// your_folder/a_subfolder”。 – Ecno92 2013-03-30 17:58:29
你知道任何包含整个文件夹的方法吗? – PascalVKooten 2013-03-30 19:47:45