2012-02-07 102 views
0

我的主要文件:py2exe字体模块无法使用

setup.py:

from distutils.core import setup 
import pygame._view 
import py2exe 
import pygame 

setup(console=['game.py']) 

game.py:

import pygame, sys, random 
import pygame._view 
from pygame.locals import * 

pygame.init() 
screen = pygame.display.set_mode([550,450]) 
screen.fill([255,255,255]) 
fnt = pygame.font.Font(None, 35) 
wrt = fnt.render('Help', True, [0,0,0]) 
screen.blit(wrt,[235,103]) 
pygame.display.update() 

start = True 
while start: 
    for event in pygame.event.get(): 
     if event.type == QUIT: 
      pygame.quit() 

然后我打开CMD,然后输入:“蟒蛇setup.py py2exe“
当它完成时,我尝试运行game.exe文件
它显示我一个错误:

http://i40.tinypic.com/10cqb11.png

感谢您的任何帮助。

+1

可能重复[使用py2exe时字体模块错误](http://stackoverflow.com/questions/6376194/font-module-error-when-using-py2exe) – 2012-02-07 12:50:08

回答

0

我碰到了同样的问题跑,我发现正是这里的解决方案:http://pygame.org/wiki/Pygame2exe

只是观察你不需要运行此代码,因为它已经在那里“py2exe”的说法:

sys.argv.append('py2exe')