Python包装器不起作用:swig_import_helper()错误

时间:2019-05-31 13:12:58

标签: python swig imebra

这与Reading Dicom files in Dlang

有关

我正在尝试Imebra的Python包装器,如上面的文章所示。

Python_wrapper.so通过以下命令创建:

$ g++ -shared -o python_wrapper.so -fPIC -I../../library/include/ -I/usr/include/python3.5m -L../../build -limebra python_wrapper.cxx 

我尝试使用以下简单的python文件加载它:

import sys
sys.path.append('../../build')
from imebra import *            # does not work;  
# import imebra                 # also does not work; 

但是出现以下错误:

$ python3 rnImebra.py 
Traceback (most recent call last):
  File "..../0-Imebra-dicom/wrappers/pythonWrapper/imebra.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named '_imebra'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "rnImebra.py", line 5, in <module>
    import imebra                               #  also does not work; 
  File "..../0-Imebra-dicom/wrappers/pythonWrapper/imebra.py", line 17, in <module>
    _imebra = swig_import_helper()
  File "..../0-Imebra-dicom/wrappers/pythonWrapper/imebra.py", line 16, in swig_import_helper
    return importlib.import_module('_imebra')
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_imebra'

问题出在哪里,如何解决?

2 个答案:

答案 0 :(得分:1)

下载源代码发行版后,只需按照user manual中的说明安装python库。

bgView.addShadowAndRoundCorners

cd imebra
python setup.py install

答案 1 :(得分:0)

..错误在此处输入评论...无法从手机中删除..