2017-03-04 211 views
0

我對Python仍然很陌生。我使用:PyInstaller ImportError:DLL加載失敗

  • 的Windows 10,64位
  • 的Python 3.5.3
  • PyInstaller 3.2.1

我想包我的第一個GUI測試的應用程序與PyInstaller。我用

pyinstaller --onedir testgui.py

這一點。由此產生的應用程序沒有運行。當我試圖運行通過命令promp的.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

https://github.com/pyi nstaller/pyinstaller/wiki/If-Things-Go-Wrong –

+0

@StephenRauch謝謝,但我已經看過,並沒有覺得它非常有幫助。也許我只是沒有足夠的經驗,也許我只是很厚,但我不知道如何「使用.spec文件」或「實現一個新的鉤子」。我將不勝感激任何實際的嘗試來幫助我。我從來沒有這樣做過。 – JohnGalt

+0

好的,我可以嘗試提供幫助,但需要鏈接中提供的具體信息。在上述情況下,它無法找到一個DLL。你是在同一臺機器上運行的嗎?也知道QT是常常難以正確使用的模塊之一。另外建議你看看pyinstaller bug跟蹤器,看看你的情況是否有價值。 –

回答

0

搜索你的硬盤上,並添加自己的文件路徑要麼你的環境變量路徑數據(控制面板→系統→高級系統設置→環境變量)丟失的文件或建立與:

pyinstaller --paths yourpathshere app.py 

例如,我的項目發現Qt5Core.dll和合作如下:

pyinstaller --paths C:\Users\MYUSERNAME\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\PyQt5\Qt\bin app.py 
相關問題