2017-04-16 3 views
-1

Ich habe kürzlich mit PyGame 1.9.3 und Python 3.4.4 an einigen Projekten gearbeitet und bin auf ein Problem gestoßen, als ich versuchte, sie mit PyInstaller zu kompilieren.PyInstaller "pygame._view not found"

Ich dachte, vielleicht war es etwas falsch mit meinem Programm wie ein Problem mit Bildern oder Schriften zu verbinden, so entschied ich mich, ein sehr kleines Testprogramm zu erstellen und versuchen, das zu kompilieren und ich bekomme die gleichen Fehler.

"WARNUNG: Versteckter Import" pygame._view "nicht gefunden!" und "Fehler beim Ausführen Test"

test.py:

import pygame 

pygame.init() 

colorWhite = (255, 255, 255) 

winDisplay = pygame.display.set_mode((1280, 720)) 
pygame.display.set_caption("Test") 
FPSClock = pygame.time.Clock() 

def main(): 
    winDisplay.fill(colorWhite) 
    pygame.display.update() 
    FPSClock.tick(60) 

if __name__ == "__main__": 
    main() 

warntest.txt:

missing module named 'win32com.gen_py' - imported by win32com, c:\python34\lib\site-packages\PyInstaller\loader\rthooks\pyi_rth_win32comgenpy.py 
missing module named pyimod03_importers - imported by PyInstaller.loader.pyimod02_archive, c:\python34\lib\site-packages\PyInstaller\loader\rthooks\pyi_rth_pkgres.py 
missing module named _dbm - imported by dbm.ndbm 
missing module named gdbm - imported by anydbm, future.moves.dbm.gnu 
missing module named _gdbm - imported by dbm.gnu 
missing module named dumbdbm - imported by anydbm, future.moves.dbm.dumb 
missing module named anydbm - imported by future.moves.dbm 
missing module named dbhash - imported by anydbm 
missing module named whichdb - imported by future.moves.dbm, anydbm 
missing module named 'test.test_support' - imported by future.moves.test.support 
missing module named 'test.support' - imported by future.moves.test.support 
missing module named dummy_thread - imported by future.backports.misc 
missing module named thread - imported by future.backports.misc, PyInstaller.loader.pyimod02_archive 
missing module named __builtin__ - imported by pyparsing, future.builtins.misc, future.utils, past.types, past.builtins.noniterators, past.builtins, past.builtins.misc 
missing module named future_builtins - imported by future.builtins.misc 
missing module named _scproxy - imported by urllib.request, future.backports.urllib.request 
missing module named multiprocessing.set_start_method - imported by multiprocessing, multiprocessing.spawn 
missing module named multiprocessing.get_start_method - imported by multiprocessing, multiprocessing.spawn 
missing module named multiprocessing.get_context - imported by multiprocessing, multiprocessing.pool, multiprocessing.managers, multiprocessing.sharedctypes 
missing module named multiprocessing.TimeoutError - imported by multiprocessing, multiprocessing.pool 
missing module named multiprocessing.AuthenticationError - imported by multiprocessing, multiprocessing.connection 
missing module named multiprocessing.BufferTooShort - imported by multiprocessing, multiprocessing.connection 
missing module named UserDict - imported by PyInstaller.compat 
missing module named 'PyInstaller.lib.macholib.compat' - imported by PyInstaller.lib.macholib.MachO 
missing module named _pkgutil - imported by PyInstaller.lib.modulegraph.modulegraph 
missing module named urllib.pathname2url - imported by urllib, PyInstaller.lib.modulegraph.modulegraph 
missing module named StringIO - imported by six, PyInstaller.lib.modulegraph.util, PyInstaller.lib.modulegraph.zipio, PyInstaller.lib.modulegraph.modulegraph 
missing module named pyimod00_crypto_key - imported by PyInstaller.loader.pyimod02_archive 
missing module named Crypto - imported by PyInstaller.building.makespec 
missing module named _sysconfigdata - imported by sysconfig 
missing module named 'com.sun' - imported by appdirs 
missing module named com - imported by appdirs 
missing module named ordereddict - imported by pyparsing 
missing module named six.moves.filter - imported by six.moves, pkg_resources 
missing module named 'six.moves.urllib' - imported by 'six.moves.urllib' 
missing module named six.moves.map - imported by six.moves, pkg_resources 
runtime module named six.moves - imported by pkg_resources, 'six.moves.urllib' 
missing module named resource - imported by posix, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named posix - imported by os, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named _posixsubprocess - imported by subprocess, multiprocessing.util, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named 'org.python' - imported by pickle, xml.sax, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named ce - imported by os, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named readline - imported by cmd, code, pdb, C:\Users\Shiloh\Desktop\TestProgram\test.py 
excluded module named _frozen_importlib - imported by importlib, PyInstaller.loader.pyimod02_archive, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named _winreg - imported by platform, pygame, pygame.sysfont, appdirs, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named java - imported by platform, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named 'java.lang' - imported by platform, xml.sax._exceptions, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named vms_lib - imported by platform, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named termios - imported by tty, getpass, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named _dummy_threading - imported by dummy_threading, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named grp - imported by tarfile, shutil, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named org - imported by copy, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named pwd - imported by posixpath, tarfile, shutil, http.server, webbrowser, distutils.util, getpass, C:\Users\Shiloh\Desktop\TestProgram\test.py 
missing module named copy_reg - imported by cStringIO, pygame 
missing module named 'pygame._view' - imported by pygame 
missing module named MacOS - imported by pygame.macosx 
missing module named macresource - imported by MacOS 
missing module named pygame.sdlmain_osx - imported by pygame, pygame.macosx 
missing module named OpenGL - imported by pygame 
missing module named numpy - imported by pygame._numpysurfarray, pygame._numpysndarray, pygame 
missing module named 'pygame.movie' - imported by pygame 
missing module named pygame.SRCALPHA - imported by pygame, pygame.ftfont 
missing module named Queue - imported by pygame.threads 
missing module named Py25Queue - imported by pygame.threads 
missing module named cStringIO - imported by pygame.compat 

Das Programm wird geladen, zeigt den weißen Bildschirm, und dann sofort schließt mit einem Befehl Eingabeaufforderungsfenster, das nur für Sekundenbruchteile einen Fehler anzeigt, bevor es verschwindet.

Ich habe versucht, den Dateinamen zu etwas anderem zu ändern, Verzeichnisse wechseln, PyGame und PyInstaller aktualisieren und pygame._view importieren, aber es gibt mir immer noch den fehlenden Modulfehler und konnte Fehler nicht ausführen. Ich bin mir nicht sicher, was ich falsch mache. Vielen Dank im Voraus.

+0

Das ist kein Fehler, es ist eine Warnung. Wenn Sie Ihre Datei von Python ausführen, hat das gleiche Verhalten, überprüfen Sie bitte Ihren ursprünglichen Code – eyllanesc

+0

Wenn ich die .py-Datei ohne Kompilierung ausführen, läuft das Programm ohne Probleme. –

+0

Laufen Sie auf einem Terminal oder einer IDE? – eyllanesc

Antwort

0

Vielleicht die cmd und IDLE halten das Fenster geöffnet, ich empfehle, dass Sie die While-Schleife mit einem flag verwenden.

import pygame 

pygame.init() 

colorWhite = (255, 255, 255) 

winDisplay = pygame.display.set_mode((1280, 720)) 
pygame.display.set_caption("Test") 
FPSClock = pygame.time.Clock() 

def main(): 
    running = True 
    while running: 
     winDisplay.fill(colorWhite) 
     pygame.display.update() 
     FPSClock.tick(60) 

     for event in pygame.event.get(): 
      if event.type == pygame.QUIT: 
       running = False 
    pygame.quit() 

if __name__ == "__main__": 
    main() 
+0

Danke! Ich fühle mich so albern, haha. Ich habe allerdings eine Frage, generell mache ich etwas ähnliches, aber ich habe nur "wahr" gesagt: "anstatt was du getan hast. Funktionieren sie anders? –

+0

Es ist ähnlich, da ich davon ausgehe, dass Sie 'sys.exit()' oder 'break' verwenden. – eyllanesc