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)

在这里插入图片描述
可以看到安装完成之后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

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐