我正在尝试从我的代码中创建一个使用 PyQt5 的可执行文件.我正在使用 Python 3.5.3 -64 位,在 Windows 10 中开发,使用 pip 安装 pyinstaller 3.2.1,并安装了 pywin32.Pyinstaller 运行但输出未找到库的警告.
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
输出这些警告.
pyinstaller Start_UI.spec
哪些输出这些警告
当我打开 pyinstaller 创建的可执行文件时,应用程序会立即关闭.我怀疑应用程序由于警告而失败.如何解决警告以使可执行文件正常工作?
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?
感谢您的回复.
我在我的计算机上搜索 DLL 文件并将它们复制到 dist 文件夹中,该文件夹通过以下方式解决了警告输出:
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
至于:
pyinstaller Start_UI.spec
我在我的 Windows SDK 安装中找到了任务 api-mis-win-crt-* dll 文件,并将它们也复制到了 dist 中.这一次,警告没有得到解决,因为 pyinstaller 找不到 dll 文件.我需要将 api dll 文件放在哪里以便 pyinstaller 找到它们?
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?
经过大量研究,问题出在 Windows 10 上.虽然我没有找到 Windows 10 解决方案,但我确实在 Windows 7 中解决了我的问题.
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.
我在 Windows 7 上测试了 pyinstaller,但仍然收到警告,但不是 api-ms-win-crt-*.dll 警告.
I tested pyinstaller on Windows 7 and was still getting warnings, but not the api-ms-win-crt-*.dll warnings.
我将 Python35 目录中的所有 dll 文件复制到 pyinstaller 生成的 dist 文件夹中.至此,pyinstaller 可以将 Hello World 程序无错误地转为可执行文件:
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
但是,将 PyQt5 程序转换为可执行文件会出错,因为 pyinstaller 无法找到 Qt5*.dll 文件.要修复此问题,请将 Lib/site-packages/PyQt5/Qt/bin 下的 PyQt5、Qt5*.dll 文件复制到 dist.然后告诉 pyinstaller dll 文件在哪里使用 --path:
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
这会在 dist 中创建一个可以工作的可执行 Start_UI.exe.
This creates a working executable Start_UI.exe in dist.
这篇关于Pyinstaller:警告:找不到库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!