我仍然是Python的新手。我正在使用:
我尝试用PyInstaller打包我的第一个GUI测试应用程序。我用了
pyinstaller --onedir testgui.py
为此。生成的应用程序未运行。当我尝试通过命令提示运行.exe
文件时,它返回以下消息:
C:\PythonProjects\firstGUI\dist\testgui>testgui.exe
Traceback (most recent call last):
File "site-packages\PyInstaller\loader\rthooks\pyi_rth_qt5plugins.py", line 46, in <module>
File "c:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 573, in load_module
module = loader.load_module(fullname)
ImportError: DLL load failed: [Module not found in german....] .
Failed to execute script pyi_rth_qt5plugins
这些是我在我很短的剧本中所做的所有导入:
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
我做错了什么?如果有帮助,我可以发布我在包装过程中获得的所有警告线。
修改
我在打包过程中收到了日志中的几个WARNING: lib not found
个条目。这是完整的包装日志:
C:\PythonProjects\firstGUI>pyinstaller --onedir testgui.py
91 INFO: PyInstaller: 3.2.1
91 INFO: Python: 3.5.3
91 INFO: Platform: Windows-10-10.0.14393-SP0
92 INFO: wrote C:\PythonProjects\firstGUI\testgui.spec
93 INFO: UPX is not available.
95 INFO: Extending PYTHONPATH with paths
['C:\\PythonProjects\\firstGUI', 'C:\\PythonProjects\\firstGUI']
95 INFO: checking Analysis
95 INFO: Building Analysis because out00-Analysis.toc is non existent
95 INFO: Initializing module dependency graph...
97 INFO: Initializing module graph hooks...
98 INFO: Analyzing base_library.zip ...
2321 INFO: running Analysis out00-Analysis.toc
2323 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\xyz\appdata\local\programs\python\python35\python.exe
2539 WARNING: lib not found: api-ms-win-core-sysinfo-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
2588 WARNING: lib not found: api-ms-win-core-memory-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
2635 WARNING: lib not found: api-ms-win-core-localization-l1-2-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
2682 WARNING: lib not found: api-ms-win-core-file-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
2729 WARNING: lib not found: api-ms-win-core-handle-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
2778 WARNING: lib not found: api-ms-win-core-rtlsupport-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
2826 WARNING: lib not found: api-ms-win-core-util-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
2875 WARNING: lib not found: api-ms-win-core-processenvironment-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
2922 WARNING: lib not found: api-ms-win-core-file-l1-2-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
2968 WARNING: lib not found: api-ms-win-core-console-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3016 WARNING: lib not found: api-ms-win-core-errorhandling-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3062 WARNING: lib not found: api-ms-win-core-string-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3111 WARNING: lib not found: api-ms-win-core-processthreads-l1-1-1.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3158 WARNING: lib not found: api-ms-win-core-synch-l1-2-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3205 WARNING: lib not found: api-ms-win-core-file-l2-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3253 WARNING: lib not found: api-ms-win-core-datetime-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3300 WARNING: lib not found: api-ms-win-core-profile-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3346 WARNING: lib not found: api-ms-win-core-heap-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3394 WARNING: lib not found: api-ms-win-core-namedpipe-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3442 WARNING: lib not found: api-ms-win-core-processthreads-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3489 WARNING: lib not found: api-ms-win-core-synch-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3535 WARNING: lib not found: api-ms-win-core-debug-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3584 WARNING: lib not found: api-ms-win-core-timezone-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3630 WARNING: lib not found: api-ms-win-core-interlocked-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3678 WARNING: lib not found: api-ms-win-core-libraryloader-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
3741 INFO: Caching module hooks...
3745 INFO: Analyzing C:\PythonProjects\firstGUI\testgui.py
3773 INFO: Loading module hooks...
3773 INFO: Loading module hook "hook-xml.py"...
3946 INFO: Loading module hook "hook-PyQt5.QtCore.py"...
3997 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
4301 INFO: Loading module hook "hook-pydoc.py"...
4302 INFO: Loading module hook "hook-PyQt5.py"...
4304 INFO: Loading module hook "hook-encodings.py"...
4377 INFO: Loading module hook "hook-PyQt5.Qt.py"...
4378 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
4380 INFO: Loading module hook "hook-PyQt5.QtPrintSupport.py"...
4449 INFO: Looking for ctypes DLLs
4450 INFO: Analyzing run-time hooks ...
4453 INFO: Including run-time hook 'pyi_rth_qt5.py'
4455 INFO: Including run-time hook 'pyi_rth_qt5plugins.py'
4460 INFO: Looking for dynamic libraries
4519 WARNING: lib not found: Qt5Gui.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\platforms\qoffscreen.dll
4569 WARNING: lib not found: Qt5Core.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\platforms\qoffscreen.dll
4627 WARNING: lib not found: Qt5Gui.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\printsupport\windowsprintersupport.dll
4685 WARNING: lib not found: Qt5PrintSupport.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\printsupport\windowsprintersupport.dll
4734 WARNING: lib not found: Qt5Core.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\printsupport\windowsprintersupport.dll
4789 WARNING: lib not found: Qt5Gui.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qicns.dll
4839 WARNING: lib not found: Qt5Core.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qicns.dll
4898 WARNING: lib not found: Qt5Gui.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtga.dll
4948 WARNING: lib not found: Qt5Core.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtga.dll
5012 WARNING: lib not found: Qt5Gui.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\platforms\qwindows.dll
5086 WARNING: lib not found: Qt5Core.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\platforms\qwindows.dll
5145 WARNING: lib not found: Qt5Svg.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\iconengines\qsvgicon.dll
5195 WARNING: lib not found: Qt5Gui.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\iconengines\qsvgicon.dll
5245 WARNING: lib not found: Qt5Core.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\iconengines\qsvgicon.dll
5303 WARNING: lib not found: Qt5Gui.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qico.dll
5353 WARNING: lib not found: Qt5Core.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qico.dll
5410 WARNING: lib not found: Qt5Svg.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qsvg.dll
5460 WARNING: lib not found: Qt5Gui.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qsvg.dll
5511 WARNING: lib not found: Qt5Core.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qsvg.dll
5568 WARNING: lib not found: Qt5Gui.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtiff.dll
5619 WARNING: lib not found: Qt5Core.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtiff.dll
5678 WARNING: lib not found: Qt5Gui.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qjpeg.dll
5728 WARNING: lib not found: Qt5Core.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qjpeg.dll
5789 WARNING: lib not found: Qt5Gui.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qwebp.dll
5840 WARNING: lib not found: Qt5Core.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qwebp.dll
5895 WARNING: lib not found: Qt5Gui.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\platforms\qminimal.dll
5945 WARNING: lib not found: Qt5Core.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\platforms\qminimal.dll
6003 WARNING: lib not found: Qt5Gui.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qwbmp.dll
6053 WARNING: lib not found: Qt5Core.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qwbmp.dll
6115 WARNING: lib not found: Qt5Gui.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qgif.dll
6165 WARNING: lib not found: Qt5Core.dll dependency of C:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qgif.dll
6319 WARNING: lib not found: Qt5Core.dll dependency of c:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\QtCore.pyd
6383 WARNING: lib not found: Qt5Widgets.dll dependency of c:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\QtPrintSupport.pyd
6434 WARNING: lib not found: Qt5Gui.dll dependency of c:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\QtPrintSupport.pyd
6489 WARNING: lib not found: Qt5PrintSupport.dll dependency of c:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\QtPrintSupport.pyd
6538 WARNING: lib not found: Qt5Core.dll dependency of c:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\QtPrintSupport.pyd
6593 WARNING: lib not found: Qt5Gui.dll dependency of c:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\QtGui.pyd
6644 WARNING: lib not found: Qt5Core.dll dependency of c:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\QtGui.pyd
6703 WARNING: lib not found: Qt5Widgets.dll dependency of c:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\QtWidgets.pyd
6753 WARNING: lib not found: Qt5Gui.dll dependency of c:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\QtWidgets.pyd
6808 WARNING: lib not found: Qt5Core.dll dependency of c:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyQt5\QtWidgets.pyd
6915 INFO: Looking for eggs
6915 INFO: Using Python library c:\users\xyz\appdata\local\programs\python\python35\python35.dll
6916 INFO: Found binding redirects:
[]
6922 INFO: Warnings written to C:\PythonProjects\firstGUI\build\testgui\warntestgui.txt
6930 INFO: checking PYZ
6931 INFO: Building PYZ because out00-PYZ.toc is non existent
6931 INFO: Building PYZ (ZlibArchive) C:\PythonProjects\firstGUI\build\testgui\out00-PYZ.pyz
7387 INFO: Building PYZ (ZlibArchive) C:\PythonProjects\firstGUI\build\testgui\out00-PYZ.pyz completed successfully.
7394 INFO: checking PKG
7394 INFO: Building PKG because out00-PKG.toc is non existent
7395 INFO: Building PKG (CArchive) out00-PKG.pkg
7411 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully.
7413 INFO: Bootloader c:\users\xyz\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
7413 INFO: checking EXE
7413 INFO: Building EXE because out00-EXE.toc is non existent
7414 INFO: Building EXE from out00-EXE.toc
7415 INFO: Appending archive to EXE C:\PythonProjects\firstGUI\build\testgui\testgui.exe
7421 INFO: Building EXE from out00-EXE.toc completed successfully.
7425 INFO: checking COLLECT
7425 INFO: Building COLLECT because out00-COLLECT.toc is non existent
7426 INFO: Building COLLECT out00-COLLECT.toc
7608 INFO: Building COLLECT out00-COLLECT.toc completed successfully.
答案 0 :(得分:0)
在驱动器上搜索丢失的文件,并将其文件路径添加到环境变量路径数据(控制面板→系统→高级系统设置→环境变量)或使用以下内容构建:
pyinstaller --paths yourpathshere app.py
例如,我的项目找到Qt5Core.dll和co,如下所示:
pyinstaller --paths C:\Users\MYUSERNAME\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\PyQt5\Qt\bin app.py