Edit: Python 3.7.4, Windows 10
Edit2: I found the reason for the error. output:
Traceback (most recent call last):
File "myMain.py", line 2, in <module>
File "c:\users\faruk\appdata\local\programs\python\python37\lib\site-
packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\PyQt5\__init__.py", line 41, in <module>
File "site-packages\PyQt5\__init__.py", line 33, in find_qt
ImportError: unable to find Qt5Core.dll on PATH
[13936] Failed to execute script myMain
Here is the solution: https://stackoverflow.com/a/56962128/9377945
I am trying to convert my py files to exe with pyinstaller.
My sample code is here:
import sys
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QLabel, QGridLayout, QWidget
from PyQt5.QtCore import QSize
class HelloWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setMinimumSize(QSize(640, 480))
self.setWindowTitle("Hello world")
centralWidget = QWidget(self)
self.setCentralWidget(centralWidget)
gridLayout = QGridLayout(self)
centralWidget.setLayout(gridLayout)
title = QLabel("Hello World", self)
title.setAlignment(QtCore.Qt.AlignCenter)
gridLayout.addWidget(title, 0, 0)
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
mainWin = HelloWindow()
mainWin.show()
sys.exit( app.exec_() )
I used this code for convert:
pyinstaller main.py --noconsole
When I tried to run exe file, I got 'Failed to execute script main' error.