小编Cas*_*ern的帖子

Pygame2Exe我无法解决的错误

我做了一个"游戏".我喜欢玩它,我想将它分发给我的朋友,而无需在他们的计算机上安装Python和Pygame.

我对Py2Exe和Pyinstaller做了很多研究.我查看了许多教程,修复,错误,但它们似乎都没有帮助我.

Pyinstaller没用,因为它不喜欢Pygame中的字体,Py2exe也不会编译内置模块,所以我发现Pygame2exe只是一个预制的安装脚本,用于py2exe,包括pygame和fonts.它应该构建良好,但exe无法使用...我收到错误:

"Microsoft Visual C++运行时库

运行时错误!

程序C:...\dist\Worm Game.exe

此应用程序已请求Runtime以不寻常的方式终止.有关更多信息,请联系应用程序的支持团队."

我只是不明白......为什么我不能编译这个游戏!

这是用Python 2.7制作的游戏代码:

import pygame
import random
import os

pygame.init()

class Worm:
    def __init__(self, surface):
        self.surface = surface
        self.x = surface.get_width() / 2
        self.y = surface.get_height() / 2
        self.length = 1
        self.grow_to = 50
        self.vx = 0
        self.vy = -1
        self.body = []
        self.crashed = False
        self.color = 255, 255, 0

    def event(self, event):
        if event.key == pygame.K_UP:
            if self.vy != 1:
                self.vx = 0
                self.vy = -1
            else:
                a …
Run Code Online (Sandbox Code Playgroud)

python pygame runtime-error py2exe python-2.7

7
推荐指数
2
解决办法
2135
查看次数

标签 统计

py2exe ×1

pygame ×1

python ×1

python-2.7 ×1

runtime-error ×1