Pyinstaller not loading DLL

前端 未结 1 1601
春和景丽
春和景丽 2021-01-15 22:45

After building an exe for my python script dungeon.py, I am getting an error when PyBearLibTerminal.py (a script my program imports) tries to load

相关标签:
1条回答
  • 2021-01-15 23:19

    1) Check the dist/ folder (or whatever folder the .exe is) to make sure that the BearLibTerminal.dll is there and ready to be accessed. Your .exe won't run if it isn't there

    2) Next check the dependencies. It is not necessarily the fact that it cannot find BearLibTerminal.dll, but it cannot find what BearLibTerminal.dll depends on. If you have Visual Studio installed on your computer, use dumpbin to figure out what your DLL depends on. (dumpbin is installed here C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\dumpbin.exe)

    dumpbin /DEPENDENTS your.dll
    

    this wil list the DLLs that BearLibTerminal.dll depends on. Make sure they are included in the same directory as your exe if they apply (kernel32.dll doesn't need to be in that directory for example)

    3) if you don't have Visual Studio or dumpbin, download http://www.dependencywalker.com/ and it will accomplish the same thing

    4) If you are sure that your DLL and the DLLs it depends on are all accounted for, check your spec file to be sure it properly formatted. If there are a bunch of warnings displayed when running pyinstaller, that can cause problems. Especially if on Windows 10 (they don't play well: https://github.com/pyinstaller/pyinstaller/issues/1566)

    5) If BearLibTerminal.dll is your own dll which you compiled, makes sure it was built in release mode and your C/C++ code generation runtime library is /MT (multi-threaded)

    6) Make sure you have the most recent version of pyinstaller as well.

    It is a lot of information, but hopefully it can help solve your issue. I was dealing with the very same issue myself.

    0 讨论(0)
提交回复
热议问题