Ubuntu20.04安装使用matplotlib-cpp

前言

按官网安装方法无法有效的在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

结果
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值