簡體   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