简体   繁体   English

如何修复pyxel中的“无法在'系统'中初始化SDL”

[英]How to fix "failed to initialize SDL in 'System'" in pyxel

I was tried to excecute tutorial code include pyxel import, but there was some error "pyxel error: failed to initialize SDL in 'System'" Should I install some additional packages?我试图执行包含 pyxel 导入的教程代码,但是出现了一些错误“pyxel 错误:无法在‘系统’中初始化 SDL”我应该安装一些额外的包吗?

I'm using WSL (ubuntu18.04) and python 3.7.4 .我正在使用WSL (ubuntu18.04)python 3.7.4 I already installed :我已经安装了:

  • libsdl2-dev libsdl2-dev
  • libsdl2-image-dev libsdl2-image-dev
  • libssl-dev libssl-dev
  • zlib1g-dev zlib1g-dev
  • libbz2-dev libbz2-dev
  • libreadline-dev libreadline-dev
  • libsqlite3-dev libsqlite3-dev
  • wget获取
  • curl卷曲
  • llvm虚拟机
  • libncurses5-dev libncurses5-dev
  • libncursesw5-dev libncursesw5-dev
  • xz-utils xz-utils
  • tk-dev tk-dev
import pyxel

class app:
    def __init__(self):

It seems to be that Microsoft does not support graphical programs on WSL.好像是微软不支持 WSL 上的图形程序。 This article describes how to go about using an X server on Windows to accomplish using GUI applications from WSL. 本文介绍了如何在 Windows 上使用 X 服务器来完成使用 WSL 中的 GUI 应用程序。

You should be able to install Xming (or another X server program of choice) on Windows, and then from inside Ubuntu use the following commands to install some X applications and test to make sure it works properly.您应该能够在 Windows 上安装Xming (或其他选择的 X 服务器程序),然后从 Ubuntu 内部使用以下命令安装一些 X 应用程序并测试以确保它正常工作。

sudo apt-get install x11-apps sudo apt-get install x11-apps

export DISPLAY=:0出口显示=:0

xeyes眼睛

You should see the xeyes program pop up in a new window.您应该会在新窗口中看到 xeyes 程序弹出。

Now, all you should have to do is export your display before running the pyxel tutorial code.现在,您应该做的就是在运行 pyxel 教程代码之前导出您的显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM