我们现在正在为Ludum Dare开发一款Cocos2D游戏,我们在将游戏打包成某种可执行文件时遇到了问题。
我们已经尝试过使用py2exe,但它似乎不起作用。我读到过py2exe经常会导致这类库出现问题,但它们通常是可行的。然而,在过去的几个小时里,我一直在做一些研究,我似乎找不到解决方案。
这是它在执行.exe时给我们的错误消息,显然它不能导入pyglet.resource模块。
C:\Users\Jon\Documents\GitHubVisualStudio\King-of-the-Dungeon\King of the Dungeon\King of the Dungeon\dist>king_of_the_dungeon.exe
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pyglet\__init__.py", line 351, in __getattr__
return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute 'path'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "king_of_the_dungeon.py", line 1, in <module>
File "C:\Python34\lib\site-packages\cocos2d-0.6.3-py3.4.egg\cocos\__init__.py", line 71, in <module>
pyglet.resource.path.append(
File "C:\Python34\lib\site-packages\pyglet\__init__.py", line 357, in __getattr__
__import__(import_name)
ImportError: No module named 'pyglet.resource'发布于 2015-09-17 12:16:32
我自己也试过了,没什么问题。但我用的是cx_freeze。看,Py2exe是旧的,不再维护,总的来说,您最好使用cx_freeze。
我只是用一个简单的游戏试了试,它编译起来没有任何问题。
https://stackoverflow.com/questions/32154407
复制相似问题