Solution to abnormal operation of PyQt5 program involving sub-threads after packaging

I wrote a PyQt5 data import program, using the multiprocessing sub-thread tool, after clicking the "import" button, a sub-thread will be started to perform the data import task.

Before packaging, after clicking the "Import" button, the program can run normally.

But after packaging with pyinstaller, after clicking the "Import" button, a second identical window will pop up, which is obviously not the effect we want.

The solution is very simple, just add a sentence to the main function:

multiprocessing.freeze_support()

The problem was solved satisfactorily.

Guess you like

Origin blog.csdn.net/esa72ya/article/details/101466578