我只是使用 Py2exe 将一个简单的 pygame 程序编译成一个可执行文件,但出现以下错误:
*** 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
当我尝试运行创建的 .exe 时,它没有运行。我对 Pygame 非常熟悉,但 Py2exe 对我来说是全新的。感谢您提供任何帮助,因为我整个上午都在网上寻找解决方案。
这是我尝试运行它时出现的内容:
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)
请您参考如下方法:
尝试将其添加到您的主程序中:
from pygame.locals import *
解决了我编译pygame的问题
