- 在pycharm运行时报错
:488: RuntimeWarning: Your system is avx2 capable but pygame was not built with support for it. The performance of some of your blits could be adversely affected. Consider enabling compile time detection with environment variables like PYGAME_DETECT_AVX2=1 if you are compiling without cross compilation.
pygame 2.6.1 (SDL 2.32.54, Python 3.12.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "D:\PythonProject\start.py", line 5, in
print(pygame.get_sdl_avx2_enabled()) # 输出 True 表示已启用
AttributeError: module 'pygame' has no attribute 'get_sdl_avx2_enabled'^^^^^^^^^^^^^^^^^^^^^^^^^^^
2.代码
```python
import pygame, sys
from pygame.locals import * # 导入事件常量(包括 QUIT)
PYGAME_DETECT_AVX2=1
pygame.init()
# print(pygame.get_sdl_avx2_enabled()) # 输出 True 表示已启用
screen = pygame.display.set_mode((600, 400))
pygame.display.set_caption("Pygame welcome you!")
while True:
for event in pygame.event.get():
if event.type == QUIT:
sys.exit()
pygame.display.update()
3. 环境以及配置
运行脚本文件位于:D:\PythonProject
解释器选择的是:conda的虚拟环境的3.12的python
pygame的版本:pygame 2.6.1 py312hea106ac_0 conda-forge