我正在尝试创建一个独立的PySide6应用程序可执行文件。我的设置是:
这是一个简单的脚本,如下所示:
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import (QWidget, QApplication)
import sys
class Window(QWidget):
def __init__(self):
super(Window, self).__init__()
self.setWindowTitle("hellooo")
if __name__== "__main__":
app = QApplication([])
win = Window()
win.show()
sys.exit(app.exec_())
该应用程序作为脚本运行良好。但当我使用Pyinstaller将其转换为exe时,如下所示:
pyinstaller --onefile --debug=all --windowed --console hello.py
应用程序不会立即启动和退出,也不会显示任何有意义的错误。控制台输出如下所示:
[12384] LOADER: Setting sys.argv
[12384] LOADER: setting sys._MEIPASS
[12384] LOADER: importing modules from CArchive
[12384] LOADER: extracted struct
[12384] LOADER: callfunction returned...
[12384] LOADER: extracted pyimod01_os_path
[12384] LOADER: callfunction returned...
[12384] LOADER: extracted pyimod02_archive
[12384] LOADER: callfunction returned...
[12384] LOADER: extracted pyimod03_importers
[12384] LOADER: callfunction returned...
[12384] LOADER: Installing PYZ archive with Python modules.
[12384] LOADER: PYZ archive: PYZ-00.pyz
[12384] LOADER: Running pyiboot01_bootstrap.py
[12384] LOADER: Running pyi_rth_multiprocessing.py
[12384] LOADER: Running pyi_rth_certifi.py
[12384] LOADER: Running main_window.py
[408] LOADER: Back to parent (RC: -1073741819)
[408] LOADER: Doing cleanup
我的实际应用程序比这更复杂。我只是使用上面的例子来看看它是否可以作为exe运行,但两者都有相同的问题
注意:我已经查看了本网站和其他网站上的所有相关问题,但没有任何帮助
注意:下面第一条评论中提到的关于qt platform not found的问题不是我遇到的问题。正如我在下面的评论中提到的,我已经解决了这个特殊的错误
这里是一个linkto docs,您可以在其中找到一个表,该表总结了平台对不同打包工具的支持
Table: support for packaging tools
根据该表,目前Qt6仅部分支持PyInstaller
但是Qt官方网站有一个博客post,他们在那里写了Nuitka:
我想你可以试试它而不是PyInstaller
相关问题 更多 >
编程相关推荐