Search code examples
pythonc++dllpygamemingw32

import pygame fails with embedded c++


Hi guys this is the problem

I have installed python 2.7 and pygame 1.9 in a windows 7 32 bin When I use pygame with the python interpeter there is no problem it works fine

Then for the line

import pygame

no problem with console or calling python and the filename

But I want to embed this in a c++ project compiled with mingw32. When I import other packages like cv2 or numpy no problem but in the case of pygame I have this error

ImportError: DLL load failed: The specified module could not be found.

Does anybody knows where is the problem?

A lot of thanks


Solution

  • I have solved after a lot of googling. The problem was with the pygame packages in msi format.

    I uninstalled it and I have installed wheel and the package

    pygame‑1.9.2a0‑cp27‑none‑win_amd64.whl
    

    from the page http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

    And that works for me. There was a problem with some dll missing in the case of msi packages and minggw32 compiling

    A lot of thanks to all of us

    :)