Создал простое приложение с PYQT5 и попытался скомпилировать его в файл .exe, я создал на компьютере с Windows 10, и он прекрасно работает там, но когда я попытался переместить программное обеспечение на Windows 7 (без установленного Python), он далмне эта ошибка:
здесь мой main.py файл:
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main.ui'
#
# Created by: PyQt5 UI code generator 5.12.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QDialog
import aboutUs
import users_settings
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1332, 933)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/images/images/pos_logo.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
MainWindow.setWindowIcon(icon)
MainWindow.setLayoutDirection(QtCore.Qt.RightToLeft)
MainWindow.setStyleSheet("background:#a1d0f4;")
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 0, 3, 1, 1)
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 2, 3, 1, 1)
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.settingsToolButton = QtWidgets.QToolButton(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.settingsToolButton.sizePolicy().hasHeightForWidth())
self.settingsToolButton.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setFamily("Shorooq_N1")
font.setPointSize(36)
self.settingsToolButton.setFont(font)
self.settingsToolButton.setStyleSheet("background:#0a74c4;color:white;")
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(":/images/images/cog-256.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.settingsToolButton.setIcon(icon1)
self.settingsToolButton.setIconSize(QtCore.QSize(128, 128))
self.settingsToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
self.settingsToolButton.setObjectName("toolButton_5")
self.verticalLayout.addWidget(self.settingsToolButton)
self.toolButton_6 = QtWidgets.QToolButton(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.toolButton_6.sizePolicy().hasHeightForWidth())
self.toolButton_6.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setFamily("Shorooq_N1")
font.setPointSize(36)
self.toolButton_6.setFont(font)
self.toolButton_6.setStyleSheet("background:#fe3636;color:white;")
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap(":/images/images/close-window-256.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.toolButton_6.setIcon(icon2)
self.toolButton_6.setIconSize(QtCore.QSize(128, 128))
self.toolButton_6.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
self.toolButton_6.setObjectName("toolButton_6")
self.verticalLayout.addWidget(self.toolButton_6)
self.gridLayout.addLayout(self.verticalLayout, 2, 0, 1, 2)
self.toolButton = QtWidgets.QToolButton(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.toolButton.sizePolicy().hasHeightForWidth())
self.toolButton.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setFamily("Shorooq_N1")
font.setPointSize(48)
self.toolButton.setFont(font)
self.toolButton.setStyleSheet("background:#0a74c4;color:white;")
icon3 = QtGui.QIcon()
icon3.addPixmap(QtGui.QPixmap(":/images/images/calculator-5-256.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.toolButton.setIcon(icon3)
self.toolButton.setIconSize(QtCore.QSize(256, 256))
self.toolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
self.toolButton.setObjectName("toolButton")
self.gridLayout.addWidget(self.toolButton, 1, 3, 1, 1)
self.toolButton_2 = QtWidgets.QToolButton(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.toolButton_2.sizePolicy().hasHeightForWidth())
self.toolButton_2.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setFamily("Shorooq_N1")
font.setPointSize(48)
self.toolButton_2.setFont(font)
self.toolButton_2.setStyleSheet("background:#0a74c4;color:white;")
icon4 = QtGui.QIcon()
icon4.addPixmap(QtGui.QPixmap(":/images/images/store-256.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.toolButton_2.setIcon(icon4)
self.toolButton_2.setIconSize(QtCore.QSize(256, 256))
self.toolButton_2.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
self.toolButton_2.setObjectName("toolButton_2")
self.gridLayout.addWidget(self.toolButton_2, 1, 2, 1, 1)
self.toolButton_3 = QtWidgets.QToolButton(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.toolButton_3.sizePolicy().hasHeightForWidth())
self.toolButton_3.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setFamily("Shorooq_N1")
font.setPointSize(48)
self.toolButton_3.setFont(font)
self.toolButton_3.setStyleSheet("background:#0a74c4;color:white;")
icon5 = QtGui.QIcon()
icon5.addPixmap(QtGui.QPixmap(":/images/images/tree-structure-256.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.toolButton_3.setIcon(icon5)
self.toolButton_3.setIconSize(QtCore.QSize(256, 256))
self.toolButton_3.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
self.toolButton_3.setObjectName("toolButton_3")
self.gridLayout.addWidget(self.toolButton_3, 1, 1, 1, 1)
self.userSettingsToolButton = QtWidgets.QToolButton(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.userSettingsToolButton.sizePolicy().hasHeightForWidth())
self.userSettingsToolButton.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setFamily("Shorooq_N1")
font.setPointSize(36)
self.userSettingsToolButton.setFont(font)
self.userSettingsToolButton.setStyleSheet("background:#0a74c4;color:white;")
icon6 = QtGui.QIcon()
icon6.addPixmap(QtGui.QPixmap(":/images/images/conference-256.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.userSettingsToolButton.setIcon(icon6)
self.userSettingsToolButton.setIconSize(QtCore.QSize(256, 256))
self.userSettingsToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
self.userSettingsToolButton.setObjectName("toolButton_4")
self.userSettingsToolButton.clicked.connect(self.open_user_settings)
self.gridLayout.addWidget(self.userSettingsToolButton, 2, 2, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1332, 21))
self.menubar.setObjectName("menubar")
self.menu = QtWidgets.QMenu(self.menubar)
self.menu.setObjectName("menu")
self.menu_2 = QtWidgets.QMenu(self.menubar)
self.menu_2.setObjectName("menu_2")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.action = QtWidgets.QAction(MainWindow)
self.action.setIcon(icon5)
self.action.setObjectName("action")
self.action_2 = QtWidgets.QAction(MainWindow)
self.action_2.setIcon(icon4)
self.action_2.setObjectName("action_2")
self.action_3 = QtWidgets.QAction(MainWindow)
self.action_3.setIcon(icon3)
self.action_3.setObjectName("action_3")
self.userSettingsAction = QtWidgets.QAction(MainWindow)
self.userSettingsAction.setIcon(icon6)
self.userSettingsAction.setObjectName("action_4")
self.userSettingsAction.triggered.connect(self.open_user_settings)
self.action_6 = QtWidgets.QAction(MainWindow)
self.action_6.setIcon(icon1)
self.action_6.setObjectName("action_6")
self.action_7 = QtWidgets.QAction(MainWindow)
self.action_7.setIcon(icon2)
self.action_7.setObjectName("action_7")
self.aboutUs_menu = QtWidgets.QAction(MainWindow)
icon7 = QtGui.QIcon()
icon7.addPixmap(QtGui.QPixmap(":/images/images/favicon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.aboutUs_menu.setIcon(icon7)
self.aboutUs_menu.setObjectName("action_8")
self.aboutUs_menu.triggered.connect(self.open_about_us)
self.action_9 = QtWidgets.QAction(MainWindow)
self.action_9.setObjectName("action_9")
self.action_10 = QtWidgets.QAction(MainWindow)
icon8 = QtGui.QIcon()
icon8.addPixmap(QtGui.QPixmap(":/images/images/phone-18-256.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_10.setIcon(icon8)
self.action_10.setObjectName("action_10")
self.menu.addAction(self.action)
self.menu.addAction(self.action_2)
self.menu.addAction(self.action_3)
self.menu.addAction(self.userSettingsAction)
self.menu.addSeparator()
self.menu.addAction(self.action_6)
self.menu.addAction(self.action_7)
self.menu_2.addAction(self.aboutUs_menu)
self.menu_2.addAction(self.action_10)
self.menubar.addAction(self.menu.menuAction())
self.menubar.addAction(self.menu_2.menuAction())
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def open_about_us(self, checked=None):
if checked is None:
return
dialog = QDialog()
dialog.ui = aboutUs.Ui_Dialog()
dialog.ui.setupUi(dialog)
dialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
dialog.exec_()
def open_user_settings(self, checked=None):
if checked is None:
return
dialog = QDialog()
dialog.ui = users_settings.Ui_Form()
dialog.ui.setupUi(dialog)
dialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
dialog.exec_()
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Vision store manager - Innoventiq"))
self.label.setText(_translate("MainWindow",
"<html><head/><body><p><img src=\":/images/images/logo_small.png\"/></p></body></html>"))
self.label_2.setText(_translate("MainWindow",
"<html><head/><body><p><img src=\":/images/images/pos_logo_small.png\"/></p></body></html>"))
self.settingsToolButton.setText(_translate("MainWindow", "إعدادت عامة "))
self.toolButton_6.setText(_translate("MainWindow", "خروج "))
self.toolButton.setText(_translate("MainWindow", "الحسابات"))
self.toolButton_2.setText(_translate("MainWindow", "المخازن و الفروع"))
self.toolButton_3.setText(_translate("MainWindow", "المدخلات"))
self.userSettingsToolButton.setText(_translate("MainWindow", "إعدادات الموظفين و المستخدمين"))
self.menu.setTitle(_translate("MainWindow", "ذهاب إلى"))
self.menu_2.setTitle(_translate("MainWindow", "من نحن"))
self.action.setText(_translate("MainWindow", "المدخلات"))
self.action_2.setText(_translate("MainWindow", "المخازن و الفروع"))
self.action_3.setText(_translate("MainWindow", "الحسابات"))
self.userSettingsAction.setText(_translate("MainWindow", "المستخدمين"))
self.action_6.setText(_translate("MainWindow", "إعدادت البرنامج"))
self.action_7.setText(_translate("MainWindow", "خروج من البرنامج"))
self.aboutUs_menu.setText(_translate("MainWindow", "عن الشركة"))
self.action_9.setText(_translate("MainWindow", "الرخصة الحالة"))
self.action_10.setText(_translate("MainWindow", "الإتصال بنا"))
import rsc_rc
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
myStyle = 'Fusion'
app.setStyle(myStyle)
# The proxy style should be based on an existing style,
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.showMaximized()
sys.exit(app.exec_())
и здесьмой main.spec
:
# -*- mode: python -*-
block_cipher = None
a = Analysis(['main.py'],
pathex=['E:\\Innoventiq\\vision_manager'],
binaries=[],
datas=[
('dlls/api-ms-win-core-console-l1-1-0.dll', '.'),
('dlls/api-ms-win-core-console-l1-1-0.dll','.'),
('dlls/api-ms-win-core-console-l1-2-0.dll','.'),
('dlls/api-ms-win-crt-math-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-stdio-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-locale-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-heap-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-runtime-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-string-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-stdio-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-heap-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-runtime-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-convert-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-math-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-process-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-conio-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-filesystem-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-string-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-environment-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-time-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-stdio-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-locale-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-heap-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-runtime-l1-1-0.dll','.'),
('dlls/api-ms-win-crt-convert-l1-1-0.dll','.'),
],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False , icon='app.ico')
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='main')
Я использовал Pyinstaller для генерации файла.