Search code examples
pythonwindowspython-2.xmingw-w64

python Windows "ImportError: DLL load failed: The specified module could not be found." When loading compiled extension


I compiled a module for python using MinGW64 and it won't load.

I tried checking the file types of the files (with the mingw file command) and they are both 64 bit, so that's not the problem.


Solution

  • The trick was to add the MinGW64 lib path to the PATH.

    > set PATH=%PATH%;%MINGW64_ROOT%\x86_64-4.9.0-posix-seh-rt_v3-rev2\mingw64\bin
    

    (Also, to get this to build, I had to define the macro: MS_WIN64).