简体   繁体   English

pyinstaller python 文件 + exe 仅在一个 exe 中

[英]pyinstaller python file + exe in only one exe

py file in which I am executing a .exe file created in C++ (is inside a "data" folder) py 文件,我在其中执行在 C++ 中创建的 .exe 文件(位于“数据”文件夹中)

Python Code: os.system("data\\time.exe") Python 代码: os.system("data\\time.exe")

When I use the pyinstaller with the --onefile attribute I can't find a way for my program to compile the .py file + the "data" with another .exe inside.当我使用带有 --onefile 属性的 pyinstaller 时,我无法找到一种方法来让我的程序编译 .py 文件 + 带有另一个 .exe 的“数据”。

Does anyone know how to convert my entire program into a single .exe?有谁知道如何将我的整个程序转换为单个 .exe? in which I can run my python program and also my .exe from C++ inside?我可以在其中运行我的 python 程序以及来自 C++ 的 .exe 吗?

(I have tried to test with the .spec and with the --add-data attribute but I can't find a way that is compatible with what I want to do) (我尝试使用 .spec 和 --add-data 属性进行测试,但找不到与我想做的兼容的方法)

I look forward to your response,我期待着您的回复,

Thanks you very much <3非常感谢你<3

There is a program called auto-py-to-exe which creates an exe out of your program without requiring you to create a setup file.有一个名为 auto-py-to-exe 的程序,它可以从您的程序中创建一个 exe,而无需您创建安装文件。 The interface is great and allows you to easily create and exe without creating a setup.py.界面很棒,让您无需创建 setup.py 即可轻松创建和执行。 This also allows you to package your app as a single exe, without any other files.这还允许您将应用程序打包为单个 exe,而无需任何其他文件。 Below is a screenshot:下面是截图:

截屏

You can install the program by typing into the command line:您可以通过在命令行中键入来安装程序:

python -m pip install auto-py-to-exe python -m pip install auto-py-to-exe

You can run it by typing in:您可以通过键入以下内容来运行它:

auto-py-to-exe自动 py 到 exe

To see more about auto-py-to-exe, please visit the PyPI page at https://pypi.org/project/auto-py-to-exe/ .要查看有关 auto-py-to-exe 的更多信息,请访问位于https://pypi.org/project/auto-py-to-exe/的 PyPI 页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM