1、安装第三方库
sudo apt-get install cmake==3.18.2
#(已经安装cmake,升级一下:sudo pip install --upgrade cmake==3.18.2)
sudo pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ pytest
2、安装pybind11
1)源码下载
github:https://github.com/pybind/pybind11
克隆下来
git clone https://github.com/pybind/pybind11.git
2)编译安装
cd pybind11
mkdir build
cd build
cmake ..
make check -j 4
sudo make install #(如果使用python2需要禁用/usr/bin/下的python3)
![在这里插入图片描述](https://img-blog.csdnimg.cn/cf7d105bd445471187ca5890e7b48e1b.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5YWt5LqU6YWl,size_20,color_FFFFFF,t_70,g_se,x_16)
可以看到安装完成之后include的目录是在:/usr/local/include/,而不是在/usr/include,如果发现导入不存在,则用全路径导入
#include <string>
#include <sstream>
#include </usr/local/include/pybind11/pybind11.h>
#include </usr/local/include/pybind11/eigen.h>
#include </usr/local/include/pybind11/stl.h>
#include "teaser/registration.h"
#include "teaser/certification.h"
namespace py = pybind11;
参考文献:https://blog.csdn.net/u012483097/article/details/108797976