cx_freeze, how to import specific classes of PyQt5 and not the entire library?

0

I'm using Cx_Freeze to create .exe files and be able to run on windows without installing the python interpreter. I use the following Script, setup.py:

from cx_Freeze import setup, Executable
base = None
executables = [Executable("Gui.py", base=base)]
packages = []
options = {
    'build_exe': {
        'packages':packages,
    },
}
setup(
    name = "Ejemplo",
    options = options,
    version = "1.0.0.1",
    description = 'Ejemplo',
    executables = executables
    )

In the Gui.py script that implements the graphical interface, the following classes of the PyQt5 library are imported

from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel
from PyQt5 import uic
class ventanaInicial(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)
        uic.loadUi("Gui.ui", self)
app = QApplication(sys.argv)
main = ventanaInicial()
main.show()
app.exec_()

This is just an empty window, without any content. The problem is that the "build" folder that is created, weighs 202mb.

Most content corresponds to the classes and files in the PyQt5 folder installed in the interpreter folder.

The question in particular

Can you specify that it is the minimum that you must import to create the executable ???

Thank you for your attention, regards.

    
asked by sal_defrutas 10.07.2018 в 02:48
source

0 answers