简体   繁体   English

如何使用pygubu UI文件创建单个exe

[英]How to create single exe with a pygubu UI file

I have a UI file created from pygubu using tkinter. 我有一个使用tkinter从pygubu创建的UI文件。 I need to create a single executable file that packs everything together. 我需要创建一个将所有内容打包在一起的可执行文件。

I've tried to use pyinstaller -F, but the result file is still looking for the UI file. 我尝试使用pyinstaller -F,但结果文件仍在寻找UI文件。 I've looked at pyuic, but it doesn't look, to me, like it will work with a pygubu UI file. 我已经看过pyuic,但对我而言,它看起来并不像pygubu UI文件一样。 Additionally, I can't seem to get it to install. 此外,我似乎无法安装它。

Everything runs cleanly as a python script, it's just when I try to package it into an exe. 一切都像python脚本一样干净地运行,就在我尝试将其打包为exe时。

Errors from running the exe after creation are: 创建后运行exe时出错:

Traceback (most recent call last):
  File "Helper.py", line 365 in <module>
  File "Helper.py", line 333, in __init__
  File "site-packages\pygubu\builder\__init__.py, line 280, in add_from_file
  File "xml\etree\ElementTree.py", line 1197, in parse
  File "xml\etree\ElementTree.py", line 587, in parse
FileNotFoundError: [Errno 2] No such file or directory: 'Helper.ui'
[1756] Failed to execute script Helper

I don't want to have to redesign the UI in another tool, but I will if necessary. 我不想在其他工具中重新设计UI,但如有必要,我会这样做。 I just need that single exe file for distribution to our less tech minded staff. 我只需要该单个exe文件即可分发给我们的技术人员。

You should use --add-data or the .spec file to tell pyinstaller what to include. 您应该使用--add-data或.spec文件来告诉pyinstaller包括哪些内容。

https://pyinstaller.readthedocs.io/en/stable/spec-files.html#adding-files-to-the-bundle https://pyinstaller.readthedocs.io/en/stable/spec-files.html#adding-files-to-the-bundle

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

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