无法使用 pygame.init
Can't use pygame.init
我安装 pygame 使用:
pip3 install pygame
我无法执行任何工作并收到请求失败的错误消息。
>>> import pygame
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> WIN = pygame.display.set_mode((400, 400))
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 152 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 105
Current serial number in output stream: 106
我阅读了 pygame 文档 --> 初始化,得到了同样的信息
>>> import pygame
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> pygame.init()
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 152 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 105
Current serial number in output stream: 106
当我在 jupyter notebook 中 运行 这段代码时,内核关闭 down/dies。
由于使用 pip/pip3 未安装某些依赖项,我遇到了这个问题。
只需使用包管理器安装 pygame 即可解决此问题,该管理器安装了使 pygame 使用我的默认显卡所需的包。
但是,如果您使用 NV gpu,则无论您如何安装软件包,都可以正常使用。
否则使用:
sudo apt install python3-pygame
我安装 pygame 使用:
pip3 install pygame
我无法执行任何工作并收到请求失败的错误消息。
>>> import pygame
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> WIN = pygame.display.set_mode((400, 400))
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 152 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 105
Current serial number in output stream: 106
我阅读了 pygame 文档 --> 初始化,得到了同样的信息
>>> import pygame
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> pygame.init()
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 152 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 105
Current serial number in output stream: 106
当我在 jupyter notebook 中 运行 这段代码时,内核关闭 down/dies。
由于使用 pip/pip3 未安装某些依赖项,我遇到了这个问题。 只需使用包管理器安装 pygame 即可解决此问题,该管理器安装了使 pygame 使用我的默认显卡所需的包。
但是,如果您使用 NV gpu,则无论您如何安装软件包,都可以正常使用。
否则使用:
sudo apt install python3-pygame