python 当ursina被编译成exe时,我遇到了一些问题

ix0qys7i  于 2023-03-16  发布在  Python
关注(0)|答案(1)|浏览(271)

我开始创建一个射击游戏与ursina,我试图得到exe从这个使用pyinstaller.后,我得到了exe,当我运行应用程序,它显示我一个错误(o我已经编码了一个新的游戏与ursina,但我得到了这个:

Traceback (most recent call last):
  File "main.py", line 5, in <module>
  File "ursina\main.py", line 28, in __init__
  File "direct\showbase\ShowBase.py", line 339, in __init__
  File "direct\showbase\ShowBase.py", line 1024, in openDefaultWindow
  File "direct\showbase\ShowBase.py", line 1059, in openMainWindow
  File "direct\showbase\ShowBase.py", line 769, in openWindow
  File "direct\showbase\ShowBase.py", line 749, in <lambda>
  File "direct\showbase\ShowBase.py", line 821, in _doOpenWindow
  File "direct\showbase\ShowBase.py", line 650, in makeDefaultPipe
  File "direct\directnotify\Notifier.py", line 130, in error
Exception: No graphics pipe is available!
Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.

我的代码:

from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
from ursina.shaders import lit_with_shadows_shader

app = Ursina()

ground = Entity(model='plane', collider='box', scale=64, texture='grass', texture_scale=(4,4))

editor_camera = EditorCamera(enabled=False, ignore_paused=True)
player = FirstPersonController()

for i in range(16):
    Entity(model='cube', origin_y=-.5, scale=2, texture='brick', texture_scale=(1,2),
        x=random.uniform(-8,8),
        z=random.uniform(-8,8) + 8,
        collider='box',
        scale_y = random.uniform(2,3),
        color=color.hsv(0, 0, random.uniform(.9, 1))
        )

cube = Entity(model='cube',color=color.red,scale=3)

def update():
    cube.rotation_x = cube.rotation_x + 15
    cube.rotation_y = cube.rotation_y + 5

# Enemy()

sun = DirectionalLight()
sun.look_at(Vec3(1,-1,-1))
Sky()

app.run()
ih99xse1

ih99xse11#

要构建它,您需要打开终端并键入:

$ python -m ursina.build

而当你这样做的时候,这会创建一个名为“Build”的文件夹,打开它并打开“PROJECNAMEIDBAT”文件来启动游戏!

相关问题