所以,这是我的问题。
我正在使用 Ubuntu 12.10 在 Pygame 和 Python 3.3 中制作游戏。美好的。我会将一堆 Python 脚本捆绑到一个可执行文件中,然后分发它。也很好。我将使用 cx_freeze,因为因为我使用的是 Python 3,所以我没有其他选择。
这就是我的问题所在。我用谷歌搜索过,但没有看到类似的东西。我setup.py
的如下:
from cx_Freeze import setup, Executable
import sys
includes = ['sys', 'pygame.display', 'pygame.event', 'pygame.mixer', 'core', 'game']
build_options = {
'optimize' : 2,
'compressed': True,
'packages': ['pygame', 'core', 'game'],
'includes': includes,
'path': sys.path + ['core', 'game'],
}
executable = Executable('__init__.py',
copyDependentFiles=True,
targetDir='dist',
)
setup(name='Invasodado',
version='0.8',
description='wowza!',
options = {'build_exe': build_options},
executables=[executable])
我__init__.py
的如下:
from sys import argv
import pygame.display
import pygame.event
import pygame.mixer
pygame.mixer.init()
pygame.display.init()
pygame.font.init()
from core import gsm
#Omitted for brevity
我的其余代码(包括完整的__init__.py
)可以在https://github.com/CorundumGames/Invasodado找到,以防万一。
I get a long-ass stack trace, which can be found here http://pastebin.com/Aej05wGE . The last 10 lines of it is this;
File "/usr/local/lib/python3.3/dist-packages/cx_Freeze/finder.py", line 421, in _RunHook
method(self, *args)
File "/usr/local/lib/python3.3/dist-packages/cx_Freeze/hooks.py", line 454, in load_scipy
finder.IncludePackage("scipy.lib")
File "/usr/local/lib/python3.3/dist-packages/cx_Freeze/finder.py", line 536, in IncludePackage
self._ImportAllSubModules(module, deferredImports)
File "/usr/local/lib/python3.3/dist-packages/cx_Freeze/finder.py", line 211, in _ImportAllSubModules
recursive)
File "/usr/local/lib/python3.3/dist-packages/cx_Freeze/finder.py", line 209, in _ImportAllSubModules
if subModule.path and recursive:
AttributeError: 'NoneType' object has no attribute 'path'
In case it's relevant, I'm using Pydev and Eclipse. Now, the last line stands out because Googling it reveals nothing. I have no idea where subModule
could have become None
, and I can't easily check because cx_freeze has shit documentation.
I've never really used cx_freeze or distutils before, so I don't know what the hell I'm doing! Any help would be greatly appreciated.