如何从python 3.3的cx_freeze(或安装程序)中在一个exe文件中创建all

时间:2021-07-14 22:36:11

I have made a GUI python script that I would like to share with my coworkers to improve productivity. I need a way to include everything in one file/directory for them to use. I tried the standard

我制作了一个GUI python脚本,我想与我的同事分享,以提高工作效率。我需要一种方法将所有内容包含在一个文件/目录中,以便它们使用。我试着标准

python setup.py build

But it does not contain everything (tested on their pc's and I just get a quick command prompt popup and then it closes.)

但它不包含所有内容(在pc上测试,我只得到一个快速命令提示弹出,然后它就关闭了)。

It works fine on my machine, but I have other things installed (like python for example)

它在我的机器上工作得很好,但是我已经安装了其他东西(例如python)

My setup.py is as follows:

我的设置。py如下:

import sys
from cx_Freeze import setup, Executable

executables = [
        Executable("Blah.py")
]

buildOptions = dict(
        compressed = True,
        includes = ["Blah"],
        path = sys.path + ["modules"])

setup(
        name = "Blah",
        version = "0.1",
        description = "Blah",
        options = dict(build_exe = buildOptions),
        executables = executables)

I have spent hours searching already with no luck. I feel like there is a way to include all needed file, I am just not sure how. Any help would be appreciated. Thank you.

我已经花了几个小时的时间去寻找,却没有运气。我觉得有一种方法可以包含所有需要的文件,我只是不知道如何包含。如有任何帮助,我们将不胜感激。谢谢你!

2 个解决方案

#1


3  

I think pyinstaller is your best bet.. They do happen to have a Python3 version:

我认为装药是你最好的选择。它们碰巧有一个python版本:

py2exe - generate single executable file

py2exe -生成单个可执行文件

https://github.com/pyinstaller/pyinstaller/wiki

https://github.com/pyinstaller/pyinstaller/wiki

pip install https://github.com/pyinstaller/pyinstaller/archive/python3.zip

pip安装https://github.com/pyinstaller/pyinstaller/archive/python3.zip

#2


0  

You could try pynsist. It is an easy way to bundle Python applications for Windows and it has examples for all kinds of GUI toolkits:

你可以试试pynsist。这是将Python应用程序与Windows捆绑在一起的一种简单方法,它有各种GUI工具包的示例:

It does not rely on setup.py but on a separate config file that grabs all the necessary dependencies.

它不依赖于设置。py但是在一个单独的配置文件中,它获取所有必需的依赖项。

Repository: https://github.com/takluyver/pynsist

库:https://github.com/takluyver/pynsist

#1


3  

I think pyinstaller is your best bet.. They do happen to have a Python3 version:

我认为装药是你最好的选择。它们碰巧有一个python版本:

py2exe - generate single executable file

py2exe -生成单个可执行文件

https://github.com/pyinstaller/pyinstaller/wiki

https://github.com/pyinstaller/pyinstaller/wiki

pip install https://github.com/pyinstaller/pyinstaller/archive/python3.zip

pip安装https://github.com/pyinstaller/pyinstaller/archive/python3.zip

#2


0  

You could try pynsist. It is an easy way to bundle Python applications for Windows and it has examples for all kinds of GUI toolkits:

你可以试试pynsist。这是将Python应用程序与Windows捆绑在一起的一种简单方法,它有各种GUI工具包的示例:

It does not rely on setup.py but on a separate config file that grabs all the necessary dependencies.

它不依赖于设置。py但是在一个单独的配置文件中,它获取所有必需的依赖项。

Repository: https://github.com/takluyver/pynsist

库:https://github.com/takluyver/pynsist