I 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:
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.
importerror: dll load failed: The specified module could not be found error occurs because of the incompatibilities of Microsoft Visual C++ (Visual studio) versions. The best way to fix this error (importerror: dll load failed) is to reinstall/ install the Microsoft Visual C++ distribution.
In most cases, the “1 is not a valid Win32 application” occurs due to the incompatibility between the Windows version/type and program. Please make sure you have downloaded the right version of the installer file. Press Windows key + R to call out the Run box.
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.1 and Pygame, which is available officially only in 32 bit and you won't face this problem.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With