按官网安装方法无法有效的在ubuntu20.04系统上部署该软件,因此将最后成功安装的过程记录一下,便于以后安装
仓库地址https://github.com/lava/matplotlib-cpp.git
安装# 安装python2.7 sudo apt-get install python2.7-dev # 安装pip2 sudo add-apt-repository universe curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py sudo python2 get-pip.py # 安装tk sudo apt-get install python-tk # 安装matplotlib sudo pip2.7 install matplotlib使用
test.cpp
#include "matplotlibcpp.h"
namespace plt = matplotlibcpp;
int main() {
plt::plot({1,3,2,4});
plt::show();
}
编译
g++ test.cpp -std=c++11 -I/usr/include/python2.7 -lpython2.7
运行
./a.out
结果



