One solution Pyinstaller packaged exe error "failed to execute script XXX" of

Recently interface with PyQt5 wrote a small program, you need to be packaged into exe to use other windows, start using python 3.7 64 bit with pyinstaller packaged exe, run properly on 64-bit machines. But the goal is a 32-bit computer, it needs to be packaged 32 exe, then problems arise.

Packaging 32 exe, said that although online tutorials using python Anaconda generate a 32-bit environment, I tried, without success, opting instead to uninstall 64-bit python, as a direct loading of 32-bit python, still use pyinstaller package

When you package Although there are several warnings, but also seemingly smooth, after opening the exe report "failed to execute script XXX", the replacement of multiple versions of python, installed unloading unloading the equipment, turned a lot of information has been resolved, he intended self-reliance

As we all know, you can use this command packaged exe without a console:

pyinstaller -w -F  xxx.py 

But this is no way to see the error, thereby preserving the console:

pyinstaller -F  xxx.py 

After packing, program flash, using a mobile phone to open the video recorded (60fps), but the quality is still not slag missed "unable to find QtCore.dll on PATH":

Question should be is lost PyQt libraries, and less to fill it - directly copy the dll to C: \ Windows \ under System32, and then happily opening the exe, the problem is solved - and it did not ..... solve......

PyQt5 need to add the python library path to the PATH environment variable for the job, this time really run up, very happy (in fact, to toss this step for a long time), but is estimated to be installed on the target computer PyQt5, then Add the environment variable, though a bit cumbersome, but can be used.

So things come to an end ....

 

He did not come to an end, and I can not be reconciled, then what good 64 runs, 32 throw dll, what command line to run properly, exe to throw things? And I looked exe to a temporary directory, such as libraries are in fact Qt5Core.dll good lie in it, but why that can not find there, and then try

1. Qt5Core.dll forced to re-packaged exe, this realization can edit the spec file, change datas that line, no!

2. Try adjusting the running path at run time, or add a temporary path, so that the program can recognize who it was originally dll in the same directory level, similar to the tutorial does not find (such a demand would have been very strange for you?)

3. For the next test to another, built a virtual machine under test to rule out the difference between the system, not

4 for a lower version python tried, not

5. Try to replace packaged software, it seems mostly pyinstaller, there py_win32, cx_Freeze etc., py_win32 seemingly need to re-write interface, cx_Freeze press routine run down little effect at all.

Fee for a long time, it can be said that the heart was tired, had the honor to see the blog post:

PyInstaller package of several pit PyQT5 ....

The title can be seen very close, in fact, reduce the PyQt5 version on it, do not seem to like this post which reduced version pyinstaller of (3.5), without adding environment variables can also be packaged after normal operation, exe volume also reduces half ...

At first I used PyQt5.13.0 packing 32 being given to reducing the 5.9.2 no problem, by the way remember what pip install the specified version of the library:

pip install pyqt5==5.9.2

I like all kinds of dependent libraries written in a cmd file, double-click the installation environment needed to get away

 

It boils down to this:

When Pyinstaller packaged PyQt5 program, missing dll file when prompted, you can try to lower version PyQt5, such as pyinstaller3.5 + PyQt5.9.2 combination (@Windows 7 x64 SP1 + python 3.7.4 x32)

 

Guess you like

Origin www.cnblogs.com/caokang/p/11266013.html