本文档在于使用MV3D 过程中 其中有使用Cython 代码的.pyx 文件 而导致一系列报错,最终所幸解决
现将编译的文档和文件方法展开
在该目录下,建立setup.py文件
setup.py 文件如下所示
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
filename = 'bbox'
full_filename = 'bbox.pyx'
ext_modules = [Extension(filename, [full_filename],
include_dirs = [np.get_include(), '/lib/utils'],extra_compile_args=[],
# extra_compile_args=['-O3', '-march=native', '-ffast-math', '/openmp'],
# extra_link_args=['/openmp']
)]
setup(
cmdclass={
'build_ext': build_ext},
ext_modules=ext_modules,
include_dirs=[np.get_include()])
其中经典报错 展示如下
bbox.c:1205:10: fatal error: numpy/arrayobject.h: No such file or directory
1205 | #include "numpy/arrayobject.h"
这个主要是由于系统没能检测到numpy的路径 已经在setup.py中予以设置
最后即可跑通
现将我已经编译好的cpp文件和h文件公布给大家 ,让大家方便大家直接使用,大家可以直接下载
参看资料: