Pyinstaller: WARNING: lib not found

我是研究僧i 提交于 2019-12-02 09:44:09

问题


I'm trying create an executable from my code that uses PyQt5. I'm using Python 3.5.3 -64 bits, developing in Windows 10, used pip to install pyinstaller 3.2.1, and installed pywin32. Pyinstaller runs but outputs warnings that libraries aren't found.

I'm creating my application using the following:

pyinstaller Start_UI.py

Which outputs these warnings.

pyinstaller Start_UI.spec

Which outputs these warnings

When I open the executable that pyinstaller creates, the application closes immediately. I suspect the application is failing because of the warnings. How can I resolve the warnings so the executable works?

Thank you for the replies.

Edit: I searched for DLL files on my computer and copied them into the dist folder which resolved the warnings output by:

pyinstaller Start_UI.py

As for:

pyinstaller Start_UI.spec

I located the mission api-mis-win-crt-* dll files in my installation of Windows SDK, and copied them into dist as well. This time, the warnings were not resolved as pyinstaller can't locate the dll files. Where do I need to put the api dll files for pyinstaller to locate them?


回答1:


After a lot of research, the problem is because of Windows 10. While I didn't find a Windows 10 solution, I did solve my problem in Windows 7.

I tested pyinstaller on Windows 7 and was still getting warnings, but not the api-ms-win-crt-*.dll warnings.

I copied all the dll files in my Python35 directory into the pyinstaller generated dist folder. At this point, pyinstaller can turn a Hello World program into an executable without errors:

pyinstaller --onefile Hello_World.py

However, turning a PyQt5 program into an executable gives errors because pyinstaller can't locate the Qt5*.dll files. To fix this copy the PyQt5, Qt5*.dll files, under Lib/site-packages/PyQt5/Qt/bin and into dist. Then tell pyinstaller where the dll files are using --path:

pyinstaller --onefile --path dist Start_UI.py

This creates a working executable Start_UI.exe in dist.




回答2:


Looks like the error was due to vcruntime140.dll not being included in the dist folder. Check the executable after manually copying it to the dist folder



来源:https://stackoverflow.com/questions/44660752/pyinstaller-warning-lib-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!