简体   繁体   中英

How to fix this dll loading python error?

I use one c++ dll in my python code. When I run my python app on my computer, it works fine but when I copy all to another computer this happen:

Traceback (most recent call last):
 File "C:\users\Public\SoundLog\Code\Código Python\SoundLog\SoundLog.py", line 9, in <module>
   from Auxiliar import *
 File "C:\users\Public\SoundLog\Code\Código Python\SoundLog\Auxiliar\DataCollection.py", line 4, in <module>
   import SoundLogDLL
 File "C:\users\Public\SoundLog\Code\Código Python\SoundLog\Auxiliar\SoundLogDLL.py", line 4, in <module>
   dll = cdll.LoadLibrary(os.environ['PUBLIC'] + "\\SoundLog\\DLLs\\ForPython\\SoundLogC++WrapperDLL.dll")
 File "C:\Python26\lib\ctypes\__init__.py", line 431, in LoadLibrary
   return self._dlltype(name)
 File "C:\Python26\lib\ctypes\__init__.py", line 353, in __init__
   self._handle = _dlopen(self._name, mode)
WindowsError: [Error 14001] The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail

How can I fix this problem so that my python app work in every computer?

Note: I only need them to work on windows 7 like mine. And I tested on another win7 computer (both 32bits).

You're using a DLL which depends on a Microsoft Visual C++ runtime which isn't installed on the target computer. You have a few options:

  • Install or copy the Visual C++ runtime libraries to the target computer. Installation is done by adding merge modules to your installer (if you have one) or by running the redistributable installer ( vcredist.exe ). The various methods are documented here for VS2005 (other versions will be similar).

  • If you built the DLL, you can change the project settings to statically link the runtime libraries. See this answer to see how this is done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM