Search code examples
pythoncompilationpyqt5zipcython

Distribute embed-cython-compiled .exe and run another machine without python


I have a small pyqt5 project written in python. I generate .cpp file using cython --embed , compiled with MSVC and it is working in my machine with no problem but I want to distribute .exe with no python installed target machines. Pretty much confused about pyqt import as I get error initialization of QtCore failed without raising an exception. I tried various stuff, I put my effort a whole day but briefly put necessary files to .exe location and removed python36._pth , which is as follows

.\python36.dll
.\python36.zip (from python-3.6.5-embed-amd64.zip)
.\PyQt5  (copied from Anaconda3\Lib\site-packages)
.\platforms  (required plugins for windows)

I guess it requires also sip but I could not figure out elegant way to add pyqt5 as there is no documentation about distribution of embedded python with imported modules (site-packages). Any help would be extremely great.


Solution

  • I solved adding .\sip.pyd. Then I checked resulting folder size , it was around 20 MB. With Pyinstaller, resulting .exe is about 43 MB