網站首頁 編程語言 正文
1. 下載matplotlibcpp
https://github.com/lava/matplotlib-cpp
2. matplotlibcpp測試代碼
#include "matplotlibcpp.h"
namespace plt = matplotlibcpp;
int main() {
plt::plot({1,3,2,4});
plt::show();
}
3. 配置.vscode
3.1 配置tasks.json
在args里面添加如下路徑,根據自己的實際路徑進行配置。
// matplotlibcpp "-I", "F:\\c++_libraries\\matplotlibcpp", // matplotlibcpp.h路徑 "-I", "F:\\python3.7.8\\include", // Python.h路徑 "-I", "F:\\python3.7.8\\Lib\\site-packages\\numpy\\core\\include", // numpy/arrayobject.h路徑 "-L", "F:\\python3.7.8", // python37.dll的所在目錄 "-l", "python37" // python37.dll動態庫
3.2 配置c_cpp_properties.json
在includePath中添加如下路徑,根據自己的實際路徑進行配置。
// matplotlibcpp "F:\\c++_libraries\\matplotlibcpp", // matplotlibcpp.h路徑 "F:\\python3.7.8\\include", // Python.h路徑 "F:\\python3.7.8\\Lib\\site-packages\\numpy\\core\\include" // numpy/arrayobject.h路徑
4. 注釋掉matplotlibcpp.h中兩行代碼
配置完以后,如果直接運行,會報錯matplotlibcpp.h中有兩行重復定義,注釋即可。官方代碼也給出了提示。
// Sanity checks; comment them out or change the numpy type below if you're compiling on
// a platform where they don't apply
static_assert(sizeof(long long) == 8);
// template <> struct select_npy_type<long long> { const static NPY_TYPES type = NPY_INT64; };
static_assert(sizeof(unsigned long long) == 8);
// template <> struct select_npy_type<unsigned long long> { const static NPY_TYPES type = NPY_UINT64; };
5. 運行
最后運行即可,得到如下效果。
原文鏈接:https://blog.csdn.net/weixin_43769166/article/details/118365416
相關推薦
- 2022-10-26 python?NumPy讀取和保存點云數據實現_python
- 2023-01-14 GoLang逃逸分析講解_Golang
- 2023-05-20 linux?shell輸出換行簡單實例_linux shell
- 2022-07-12 微信小程序布局框架初步了解(彈性容器)
- 2023-03-26 使用docker安裝hadoop的實現過程_docker
- 2022-05-31 利用python庫matplotlib繪制不同的圖表_python
- 2023-01-31 MongoDB?模式設計詳解_MongoDB
- 2022-09-08 python?logging模塊的分文件存放詳析_python
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支