Mac OS X Python ctypes cdll错误:找不到图像

恶魔古

我是Python的初学者。当我尝试加载外部DLL(由其他人在Windows中编译)时,如下所示:

from ctypes import *
import cv2, cv as cv

PainterRender = CDLL('/Users/gulilin/Desktop/DLL/PainterRenderDll') 

发生错误,如下所示:

Traceback (most recent call last):
  File "/Users/gulilin/Desktop/Project/DLL Test.py", line 7, in <module>
  PainterRender = CDLL('/Users/gulilin/Desktop/DLL/PainterRenderDll') 
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/gulilin/Desktop/DLL/PainterRenderDll, 6): image not found

谁能告诉我这是怎么回事?

斯蒂芬·温格(Stephan Wenger)

共享库(例如Windows DLL)就像编译的二进制可执行文件:它们仅在编译它们的平台上运行。ctypes可以也不会在不同平台上的各种二进制格式和调用约定之间转换。您将不得不将DLL重新编译为Mac OS共享库(我认为是.dylib)。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章