0

Python 3.8.1

使用 python-arcade 和 linux manjaro os

这个项目是一个用python街机构建的多人游戏

我在运行时收到这些错误:

class Client(arcade.Window):

    def __init__(
        self, 
        width: int, 
        height: int, 
        title: str = 'Immortals'
    ) -> None:
        super().__init__(width, height, title=title)
Traceback (most recent call last):
  File "/home/iddos/Documents/Github/Python/immortals/immortals/main.py", line 42, in <module>
    main(**config['resolution'])
  File "/home/iddos/Documents/Github/Python/immortals/immortals/main.py", line 20, in main
    window = Immortals(*args, **kwargs)
  File "/home/iddos/Documents/Github/Python/immortals/immortals/core/client.py", line 40, in __init__
    super().__init__(width, height, title=title)
  File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/arcade/application.py", line 70, in __init__
    super().__init__(width=width, height=height, caption=title,
  File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/pyglet/window/xlib/__init__.py", line 171, in __init__
    super(XlibWindow, self).__init__(*args, **kwargs)
  File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/pyglet/window/__init__.py", line 642, in __init__
    self._create()
  File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/arcade/application.py", line 469, in _create
    super()._create()
  File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/pyglet/window/xlib/__init__.py", line 352, in _create
    self.set_caption(self._caption)
  File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/arcade/application.py", line 481, in set_caption
    super().set_caption(caption)
  File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/pyglet/window/xlib/__init__.py", line 511, in set_caption
    self._set_text_property('_NET_WM_NAME', caption)
  File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/pyglet/window/xlib/__init__.py", line 785, in _set_text_property
    raise XlibException('Could not create UTF8 text property')
pyglet.window.xlib.XlibException: Could not create UTF8 text property

还有这个 ffmpeg not found 错误,尽管 ffmpeg 在 /usr/bin/ffmpeg

Unable to find match for ffmpeg sound library at expected location: /home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib64/python3.8/site-packages/pyglet_ffmpeg2/linux_x86_64/libavfilter.so.7.

我很想从你们那里得到一些帮助,因为我还没有找到解决方案。

你也可以通过 discord 联系我 - F4zi.#1107

4

2 回答 2

0

我解决问题如下。

1.给出如下命令。

$ sudo locale-gen en_US en_US.UTF-8

2.在滚动菜单中选择以下

en_US.UTF-8

3.确认命令

$ sudo locale-gen en_US en_US.UTF-8

4.重启

$ sudo reboot 

干杯!

于 2020-11-28T04:57:15.917 回答
0

您正在获得pyglet.window.xlib.XlibException: Could not create UTF8 text property,因为您的语言环境配置不正确。此错误来自语言环境中的 LANG 属性。

这可以通过

在你的终端

  1. LANG=en_US
  2. 从终端运行你的 python 代码

另一种解决方案是通过在代码的开头(在所有内容之前)添加这段代码来为您的代码配置语言环境

import os
os.environ['LANG']='en_US'
于 2020-03-28T04:20:52.587 回答