Python 解决“DLL 加载失败:%1 不是有效的 Win32 应用程序。” 用于 Pygame
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4676433/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Solving "DLL load failed: %1 is not a valid Win32 application." for Pygame
提问by Parseltongue
I recently installed Python 3.1 and the Pygame module for Python 3.1 When I type import python in the console I get the following error:
我最近安装了 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.
Please help!
请帮忙!
采纳答案by Senthil Kumaran
It could be due to the architecture of your OS. Is your OS 64 Bit and have you installed 64 bit version of Python? It may help to install both 32 bit version Python 3.1and Pygame, which is available officially only in 32 bit and you won't face this problem.
这可能是由于您的操作系统的架构。您的操作系统是 64 位并且您是否安装了 64 位版本的 Python?安装 32 位版本的Python 3.1和Pygame可能会有所帮助,后者仅在 32 位正式可用,您不会遇到此问题。
I see that 64 bit pygame is maintained here, you might also want to try uninstalling Pygame only and install the 64 bit version on your existing python3.1, if not choose go for both 32-bit version.
我看到这里维护了64 位 pygame ,您可能还想尝试仅卸载 Pygame 并在现有的 python3.1 上安装 64 位版本,如果没有选择同时使用 32 位版本。
回答by Alexis
回答by liborm
Another possible cause of similar issue could be wrong processorArchitecturein the cx_freeze manifest, trying to load x86 common controls dll in x64 process - should be fixed by this patch:
类似问题的另一个可能原因可能是processorArchitecturecx_freeze 清单中的错误,尝试在 x64 进程中加载 x86 通用控件 dll - 应通过此补丁修复:
回答by Jon
I had installed Python 32 bit version and psycopg2 64 bit version to get this problem. I installed psycopg2 32 bit version and then it worked.
我已经安装了 Python 32 位版本和 psycopg2 64 位版本来解决这个问题。我安装了 psycopg2 32 位版本,然后它工作了。
回答by Adam Francey
Had this issue on Python 2.7.9, solved by updating to Python 2.7.10 (unreleased when this question was asked and answered).
在 Python 2.7.9 上有这个问题,通过更新到 Python 2.7.10 解决(在提出和回答这个问题时未发布)。

