Pyinstaller win32 qt 应用程序不工作

Pyinstaller win32 qt app not working

我有 2 个虚拟机 win32win64。我使用 PyQt5 构建程序并使用 PyInstaller(3.3.1) 打包它,使用以下命令:

pyinstaller updater.py --noconsole --onefile -i icons/icon.ico

当我在 win64 机器上执行此操作时,它工作正常。程序工作。但是当我在 win32 机器上做同样的事情时,我生成的 .exe 文件开始需要管理员权限,甚至在确认应用程序崩溃后也是如此。我检查了这个问题:Why does my pyinstaller created executable require admin privileges?

并重命名应用程序,但它仍然崩溃。什么会导致这个?为什么在 win32 Defender 上阻止我的应用程序或者原因不在 Defender 中。

class MainWindow(QtWidgets.QMainWindow):

    def __init__(self):
        super(MainWindow, self).__init__(flags=QtCore.Qt.Dialog)
        self.progress_bar = QtWidgets.QProgressBar()
        self.progress_label = QtWidgets.QLabel()
        central_widget = QtWidgets.QWidget(flags=QtCore.Qt.Widget)
        central_layout = QtWidgets.QVBoxLayout()
        central_layout.addWidget(self.progress_bar)
        central_layout.addWidget(self.progress_label, alignment=QtCore.Qt.AlignLeft)
        central_widget.setLayout(central_layout)
        self.setCentralWidget(central_widget)
        self.progress_label.setStyleSheet('color: grey')


def main():
    application = QtWidgets.QApplication(sys.argv)

    main_window = MainWindow()
    main_window.setFixedSize(480, 120)
    main_window.show()

    sys.exit(application.exec_())


if __name__ == '__main__':
    main()

requirements.txt:

PyInstaller==3.3.1
PyQt5==5.10.1
requests==2.18.4

问题是因为我使用python 3.7,但是PyIntaller 还不支持3.7。 3.6 工作正常,但仍然要求管理员权限...