2

I'm just using Py2exe to compile a simple pygame program into an executable file, but I get the following error:

*** binary dependencies ***
Your executable(s) also depend on these dlls which are not included, you may or
may not need to distribute them.

Make sure you have the license if you distribute any of them, and make sure you
don't distribute files belonging to the operating system.

    OLEAUT32.dll - C:\windows\system32\OLEAUT32.dll
    USER32.dll - C:\windows\system32\USER32.dll
    IMM32.dll - C:\windows\system32\IMM32.dll
    SHELL32.dll - C:\windows\system32\SHELL32.dll
    ole32.dll - C:\windows\system32\ole32.dll
    COMDLG32.dll - C:\windows\system32\COMDLG32.dll
    COMCTL32.dll - C:\windows\system32\COMCTL32.dll
    ADVAPI32.DLL - C:\windows\system32\ADVAPI32.DLL
    WS2_32.dll - C:\windows\system32\WS2_32.dll
    GDI32.dll - C:\windows\system32\GDI32.dll
    WINMM.DLL - C:\windows\system32\WINMM.DLL
    KERNEL32.dll - C:\windows\system32\KERNEL32.dll
    SDL_ttf.dll - C:\Python27\lib\site-packages\pygame\SDL_ttf.dll
    libogg-0.dll - C:\Python27\lib\site-packages\pygame\libogg-0.dll

When I try to run the .exe that was created, it doesn't run. I'm quite familiar with Pygame, but Py2exe is entirely new to me. Any help is appreciated, as I've looked through the web all morning for a solution.

This is what appears when I try to run it:

test.exe:1: RuntimeWarning: import display: No module named _view
    (ImportError: No module named _view)
    test.exe:1: RuntimeWarning: import draw: No module named _view
    (ImportError: No module named _view)
    test.exe:1: RuntimeWarning: import image: No module named _view
    (ImportError: No module named _view)
    test.exe:1: RuntimeWarning: import pixelcopy: No module named _view
    (ImportError: No module named _view)
    test.exe:1: RuntimeWarning: import transform: No module named _view
    (ImportError: No module named _view)
    Traceback (most recent call last):
      File "test.py", line 7, in <module>
      File "pygame\__init__.pyc", line 70, in __getattr__
    NotImplementedError: display module not available
    (ImportError: No module named _view)
4

1 回答 1

0

尝试将其添加到您的主程序中:

from pygame.locals import *

它在编译 pygame 时解决了我的问题

于 2015-01-18T22:23:54.423 回答