ctypes和matplotlib之间的冲突

时间:2014-02-24 13:41:31

标签: python macos matplotlib ctypes

我正在尝试通过ctypes使用C库提供的一些功能。代码是这样的:

from ctypes import *

astdll = cdll.LoadLibrary('mylib.dylib')

这工作正常,但是一旦我导入pylab或其他matplotlib模块,我就会收到这样的错误:

python test.py
Traceback (most recent call last):
  File "test.py", line 6, in <module>
    astdll = cdll.LoadLibrary('mylib.dylib')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "/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(mylib.dylib, 6): initializer function 0x7fff8883a26e not in mapped image for /Users/xxx//mylib.dylib

OS X Mavericks下会出现此问题。它在Linux和Windows下运行良好。

0 个答案:

没有答案