繁体   English   中英

如何修复此dll加载python错误?

[英]How to fix this dll loading python error?

我在python代码中使用了一个c ++ dll。 当我在计算机上运行python应用程序时,它工作正常,但是当我将所有内容复制到另一台计算机时,就会发生这种情况:

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

如何解决此问题,以便我的python应用程序可在每台计算机上使用?

注意:我只需要它们像我一样在Windows 7上工作。 我在另一台win7计算机(均为32位)上进行了测试。

您使用的DLL依赖于目标计算机上未安装的Microsoft Visual C ++运行时。 您有几种选择:

  • 将Visual C ++运行时库安装或复制到目标计算机。 通过将合并模块添加到安装程序(如果有)或通过运行可重新分发的安装程序( vcredist.exe )来完成安装。 此处记录了VS2005的各种方法(其他版本将与此类似)。

  • 如果构建了DLL,则可以更改项目设置以静态链接运行时库。 查看此答案以了解如何完成此操作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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