我安装了 Python 3.1 和 Python 3.1 的 Pygame 模块。当我在控制台中输入 import python
时,出现以下错误:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import pygame
File "C:\Python31\lib\site-packages\pygame\__init__.py", line 95, in <module>
from pygame.base import *
ImportError: DLL load failed: %1 is not a valid Win32 application.
最佳答案
这可能是由于您的操作系统的架构所致。您的操作系统是 64 位并且您安装了 64 位版本的 Python 吗?安装 32 位版本 Python 3.1 可能会有所帮助和 Pygame ,官方仅提供 32 位版本,您不会遇到此问题。
我看到 64 位 pygame 得到维护 here ,您可能还想尝试仅卸载 Pygame 并在现有的 python3.1 上安装 64 位版本,如果不选择同时安装 32 位版本。
关于python - 解决 Pygame 的 "DLL load failed: %1 is not a valid Win32 application.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30205875/