如何在cx_freeze中包含一个文件夹? [英] How can I include a folder with cx_freeze?

查看:135
本文介绍了如何在cx_freeze中包含一个文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用cx_freeze部署我的应用程序。我想包含整个目录,因为包含单个文件不会将它们放在文件夹中。如何包含文件夹?

I am using cx_freeze to deploy my application. I would like to include a entire directory since including individual files doesn't put them in a folder. How can I include a folder?

推荐答案

您必须为构建选项设置包含文件参数。您可以通过不同的方式执行此操作,但是我将展示部分配置。我在这里描述的是针对一个特定的文件和一个特定的目的地。我认为您也可以设置这样的路径,但我尚未对此进行测试。

You have to set up an include files argument for the building options. You can do this in different ways, but I will show a part of my configuration. The thing I describe here is for one specific file and one specific destination. I think you can also set a path like this, but I don't have tested this yet.

编辑:已对此进行了测试,因此请为您的项目选择正确的方法。

Tested this, so choose the right approach for your project.

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)

也看看这个话题。它大概解决了相同的问题:我如何捆绑其他文件使用cx_freeze时是什么?

Take also a look at this topic. It adressed propably the same question: How can i bundle other files when using cx_freeze?

这篇关于如何在cx_freeze中包含一个文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆