2017-06-20 8 views
2

Ich versuche eine ausführbare Datei aus meinem Code zu erstellen, der PyQt5 verwendet. Ich benutze Python 3.5.3 -64 Bit, entwickelt in Windows 10, und benutze pip um pyinstaller 3.2.1 zu installieren.Pyinstaller: Importfehler: DLL-Laden fehlgeschlagen: Das angegebene Modul konnte nicht gefunden werden

Ich betreibe pyinstaller als solche:

pyinstaller.exe --onefile --windowed main.py 

ich einen Fehler beim Import erhalten:

File "C:\Python35\Scripts\pyinstaller-script.py", line 11, in <module> load_entry_point('PyInstaller==3.2.1', 'console_scripts', 'pyinstaller')() 
File "C:\Python35\lib\site-packages\pkg_resources\__init__.py", line 565, in load_entry_point 
return get_distribution(dist).load_entry_point(group, name) 
File "C:\Python35\lib\site-packages\pkg_resources\__init__.py", line 2631, in load_entry_point 
return ep.load() 
File "C:\Python35\lib\site-packages\pkg_resources\__init__.py", line 2291, in load 
return self.resolve() 
File "C:\Python35\lib\site-packages\pkg_resources\__init__.py", line 2297, in resolve 
module = __import__(self.module_name, fromlist=['__name__'], level=0) 
File "C:\Python35\lib\site-packages\PyInstaller\__main__.py", line 21, in <module> 
import PyInstaller.building.build_main 
File "C:\Python35\lib\site-packages\PyInstaller\building\build_main.py", line 32, in <module> 
from ..depend import bindepend 
File "C:\Python35\lib\site-packages\PyInstaller\depend\bindepend.py", line 38, in <module> 
from ..utils.win32.winmanifest import RT_MANIFEST 
File "C:\Python35\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 97, in <module> 
from PyInstaller.utils.win32 import winresource 
File "C:\Python35\lib\site-packages\PyInstaller\utils\win32\winresource.py", line 20, in <module> 
import pywintypes 
File "C:\Python35\lib\site-packages\win32\lib\pywintypes.py", line 124, in <module> 
__import_pywin32_system_module__("pywintypes", globals()) 
File "C:\Python35\lib\site-packages\win32\lib\pywintypes.py", line 64, in __import_pywin32_system_module__ 
import _win32sysloader 
ImportError: DLL load failed: The specified module could not be found. 

Ich habe gelesen, dass diese Bedeutungen pywin32 nicht von pip installiert wurde und dass ich diese installieren Microsoft Visual Paket: https://www.microsoft.com/en-us/download/details.aspx?id=5555. Ich habe es heruntergeladen und installiert, aber ich bekomme den gleichen Fehler.

Edit:

Nach pywin32 von sourceforge.net/projects/pywin32/files/pywin32/Build%20221 Installation der Import Fehler gegangen ist, aber ich bin immer Warnungen, wenn es läuft (der Ausgang Hunderte von Zeilen lang, hier ist ein Ausschnitt):

pyinstaller main.py 

....

3220 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\Python35\python.exe 

3251 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\Python35\python.exe 

3267 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of C:\Python35\python.exe 

3305 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\Python35\python.exe 

3336 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of C:\Python35\python.exe 

....

9265 WARNING: lib not found: Qt5Core.dll dependency of C:\Python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qgif.dll 

9297 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\Python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qgif.dll 

9333 WARNING: lib not found: Qt5Gui.dll dependency of C:\Python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qgif.dll 

9366 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\Python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qgif.dll 

Dann laufe ich:

pyinstaller main.spec 

und ähnliche Warnungen erhalten. Die resultierende exe-Datei wird sofort geschlossen.

+0

versuchen Sie es ohne Fenster oder verwenden Sie die Spec-Datei stattdessen –

+0

Es ohne Fenster funktioniert hat nicht funktioniert. Was ist die Spezifikationsdatei? – Jaitnium

+0

run '' 'pyinstaller file.py''' dann wird eine Datei namens' '' file.spec''' erstellt –

Antwort

1

Sie müssen pyinstaller und pywin32 installieren, das ist die gleiche Bit-Version wie Ihre Python-Bit-Version ist.

Erhalten Sie es von hier: https://sourceforge.net/projects/pywin32/files/pywin32/Build%20214/

amd64 diejenigen wählen, wenn Ihre Python 64-Bit sonst nicht-amd64 diejenigen ist

Wenn Sie irgendwelche Probleme in der Registrierung stellen (oder) Python-Installationsverzeichnis keine Probleme gefunden, ich kann helfen

+0

Ich sehe keine Version für Python 3.5. Ich heruntergeladen und führte pywin32-214.win-amd64-py3.1.exe, aber es will Python 3.1. – Jaitnium

+1

https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/ –

+0

Ich habe pywin32-221.win-amd64-py3.5 installiert und das scheint das Importproblem gelöst zu haben. Ich bekomme jetzt eine Menge von "WARNUNG: lib nicht gefunden: ...", während es läuft. – Jaitnium

Verwandte Themen