1.pybind11的安装:
(1)先安装这些第三方库:
sudo apt-get install cmake==3.18.2(如果已经安装cmake,可以升级一下cmake:sudo pip install --upgrade cmake==3.18.2)
sudo pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ pytest
(2)安装pybind11:
a.先下载pybind11的源代码:https://github.com/pybind/pybind11
b.进入pybind源代码,并建立新文件build,进行build,cmake,make..,具体如下:
cd that_folder
mkdir build
cd build
cmake ..
make check -j 4 (make and check, not necessary)
sudo make install (maybe should disable python3 in /usr/bin/ if you use python2)
2.C++利用pybind11转化为python API:
(1)建立一个新文件夹example,把编译后好的pybind11-master,放在example里面,然后在example文件夹新建example.cpp,并编辑:

本文介绍pybind11的安装步骤及如何将其用于创建Python API,还提供了使用pybind11处理图像数据的具体实例,并与Python和cv2进行了性能对比。

675

被折叠的 条评论
为什么被折叠?



