所以,这就是我的问题。
我正在用Pygame和Python 3.3制作一个游戏,使用的是Ubuntu 12.10。很好。我将把一堆Python脚本捆绑到一个可执行文件中,然后分发它。也很好。我选择使用cx_freeze,因为我使用的是Python3,所以没有其他选择。
这就是我的问题所在。我用谷歌搜索过,但还没见过这样的东西。我的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上找到,以防相关。
我得到了一个很长的堆栈跟踪,可以在http://pastebin.com/Aej05wGE中找到。它的最后10行是这样的;
  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'如果相关,我使用Pydev和Eclipse。现在,最后一行很突出,因为在谷歌上搜索它什么也没发现。我不知道subModule在哪里可以成为None,而且我也不能轻易地检查,因为cx_freeze有垃圾文档。
我从来没有真正使用过cx_freeze或distutils,所以我不知道我到底在做什么!任何帮助都将不胜感激。
发布于 2013-03-08 02:35:15
深入研究了这一点,这是cx_Freeze中的一个错误,只有当你安装了PEP 3149后有一个以上的Python版本时,它才会受到影响-也就是说,它不会出现在3.3之前。
我已经为它提交了一个错误报告:https://bitbucket.org/anthony_tuininga/cx_freeze/issue/22/error-when-scanning-for-modules-with-a
同时,你现在可以通过使用Python 3.2来避免这个问题,因为这是Ubuntu 12.10的默认设置。在13.04中,Python 3.3将成为默认设置。
https://stackoverflow.com/questions/15214020
复制相似问题