Skip to content
Advertisement

Unable to deploy python program with cx_freeze due to cv2

So I have a fairly large python program that I want to port to other machines (ubuntu 18.04) without having to install all the python packages and dependencies for each machine, I chose to use cx_Freeze for this and it seems to build the project fine into a single executable but the executable crashes when calling cv2.imshow. I managed to reproduce the error with this small snippet of code:

JavaScript

this is my cx_Freeze build script:

JavaScript

and this is the error I get:

JavaScript

I also tried running the program with QT_DEBUG_PLUGINS=1 for a more detailed error output:

JavaScript

Any help/suggestions would be greatly appreciated. I tried using pyInstaller, but it doesn’t manage to even build the project.

Advertisement

Answer

So thanks to jpeg from the other answer I managed to fix the issue by adding the following snippet of code to my builds script:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement