包含c ++扩展时的Python导入错误

时间:2015-10-28 21:36:14

标签: python c++ linker

在python中,我使用扩展来包装我的C ++代码并在python中使用它。我可以编译和链接我的代码。但是,一旦我在python

中导入生成的模块'example'
import example

我收到以下错误。 (我用“路径”替换了模块的路径)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/<path>/example.py", line 28, in <module>
_example = swig_import_helper()
  File "/<path>/example.py", line 24, in swig_import_helper
_mod = imp.load_module('_example', fp, pathname, description)
  File "/<otherpath>/lib/python3.4/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
ImportError: dlopen(/<path>/_example.so, 2): Symbol not found: __ZN5boost4math12sph_hankel_1IiiEESt7complexINS0_6detail13bessel_traitsIT_T0_NS0_8policies6policyINS7_14default_policyES9_S9_S9_S9_S9_S9_S9_S9_S9_S9_S9_S9_EEE11result_typeEES5_S6_
  Referenced from: /<path>/_example.so
  Expected in: dynamic lookup

0 个答案:

没有答案