【问题标题】:Is it possible to run a game from pygame using WSL and jupyter lab?是否可以使用 WSL 和 jupyter lab 从 pygame 运行游戏?
【发布时间】:2019-12-18 19:41:35
【问题描述】:

我正在尝试从 WSL (Debian) 上的 github 存储库运行 Mario Kart 克隆,但我的 WSL 不包括 X11。所以,我想知道是否可以从 Jupyter 实验室启动它。当我尝试启动它时,我收到一个错误:

pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM default
Traceback (most recent call last):
  File "MarioKart.pyw", line 14, in <module>
    screen = pygame.display.set_mode(MENU_DIMENSIONS)
pygame.error: No available video device

github 仓库:https://github.com/s4rd0n1k/pygame_mariokart

【问题讨论】:

    标签: pygame windows-subsystem-for-linux jupyter-lab


    【解决方案1】:

    您的直接问题是声音问题。这应该由

    解决

    导出 SDL_AUDIODRIVER='dsp'

    或者在 Jupyter Lab 中设置环境变量所需的任何东西。

    除此之外,我不知道图形是否可以工作。

    【讨论】:

      【解决方案2】:

      安装 XLaunch 并使用所有默认设置运行它,除了选中“禁用访问控制”

      下一个添加

      import os
      os.environ["SDL_VIDEODRIVER"]="x11"
      

      到你的 python 文件的顶部。这在 WSL 2 中对我有用

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-08-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-03-10
        相关资源
        最近更新 更多