pybind11的安装以及库的使用(ubuntu20.14)

2023-11-04

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

pybind11的安装以及库的使用(ubuntu20.14) 的相关文章

随机推荐