I'm trying to generate an executable with pyinstaller. I'm using PyQt5 so I have an .ui-File. I need an executable, where the ui file is not needed separately so that everything is in one file. I tried several things, e.g like described here but I didn't get it. Can anyone help me? I get the error FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\xxx\AppData\Local\Temp\_MEI181562\visu.ui'
Here is a minimal example: visu.py
import sys
from PyQt5 import QtWidgets, uic
Ui_MainWindow, QtBaseClass = uic.loadUiType('visu.ui')
class MyWindow(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    window = MyWindow()
    window.show()
    sys.exit(app.exec_())
And visu.ui
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Dialog</class>
 <widget class="QDialog" name="Dialog">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>172</width>
    <height>122</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Dialog</string>
  </property>
  <widget class="QPushButton" name="pushButton">
   <property name="geometry">
    <rect>
     <x>40</x>
     <y>50</y>
     <width>93</width>
     <height>28</height>
    </rect>
   </property>
   <property name="text">
    <string>Ok</string>
   </property>
  </widget>
 </widget>
 <resources/>
 <connections/>
</ui>