Pygame on Windows: ImportError: DLL loading error

I just installed PyGame 1.9.1 (on existing python 2.6.4). Python and its standard libraries work, however there is a problem that python can even find the pygame modules (correctly).

Traceback (most recent call last): File "C:\foo\bar\firstGame.py", line 2, in <module> import pygame File "C:\python264\lib\site-packages\pygame\__init__.py", line 95, in <module> from pygame.base import * ImportError: DLL load failed: The specified module could not be found. 

Why is this happening? Googling gave the following answers, which I tried to no avail:

Has anyone there fixed problems in win + pygame?

thanks


EDIT: Added additional information on request:
- Windows version: Windows Vista (regularly updated)
- Installer Used: Windows MSI Installers
- Installed for: All users
- Number of files in C:\python264\lib\site-packages\pygame :

  • DLL: 14
  • PYD: 34
  • PY: 19
  • PYC: 1
+7
python windows import dll pygame
source share
7 answers

Are you sure you have pygame for Python 2.6? Version 2.5 does not work and generates this msg error because the pyd file will not find the python 2.5 dll.

+4
source share

I ran into this error on 64bit Windows. I uninstalled my python 3.4.1 and I installed: python-3.4.1.amd64.msi and then pygame-1.9.2a0.win-amd64-py3.4.exe from the link mentioned above. And it worked.

+3
source share

If you are using a 64-bit version of Windows with 64-bit python, the default installers on the Pygame site do not work.

The pygame website led me there: there are some preliminary versions for 64-bit windows, and for python 2.7 - http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

+2
source share

This really happened with my installation. I have Python 2.6.6 installed, but the installation did not include Pygame. I downloaded Pygame 1.9.1 from Python 2.6 and determined where the directory is located, the installation seemed to work. However, from IDLE I entered import pygame and got the very error that was originally sent.

+1
source share

To check which particular DLL is missing, use CMD as the python console. A pop-up message will appear indicating the missing DLL. Pygame works for me.

0
source share

I had the same error, however, I ran a small program, I found the used pygame without IDLE (saving the code, and then just double-clicking the .py file), and it worked 100% perfectly.

0
source share

I had this error, and after many searches, it turned out that the python interpreter version MUST match the installed pygame version.

If you have the wrong combination, it is best to delete what you have using Start → Control Panel → Uninstall Programs.

The combination that works (installation in this order) -

Python 3.2.5 - msi download this file for Windows Vista 32-bit -

www.python.org/download/releases/3.2.5/- Windows x86 MSI Installer (3.2.5) <- This link is about half a page

Pygame - pygame.org/download.shtml -

pygame-1.9.2a0.win32-py3.2.msi <- This download link is at the bottom of the bottom of the page.

Now you can open IDLE (the default development environment) by finding the python folder from your Start menu. After opening it, enter "import pygame". Hope you don't get any errors and pygame has been imported properly. I wish you good luck in your programs.

If you are disappointed with the IDLE environment and want to use another, I personally use the LiClipse ID environment. I have no reputation, but google search should bring it out;)

0
source share

All Articles