c++ - 安装 matplotlib-cpp 时遇到问题
问题描述
您好我正在尝试在 Arch 系统上安装库 matplotlib-cpp。这就是我得到的:
[luca@luca-mb matplotlib-cpp-master]$ make
mkdir -p examples/build
g++ -o examples/build/lines3d examples/lines3d.cpp -I/usr/include/python3.9 -I/usr/include/python3.9 -I/home/luca/.local/lib/python3.9/site-packages/numpy/core/include -std=c++11 -Wno-conversion -L/usr/lib -lpython3.9 -lcrypt -lpthread -ldl -lutil -lm -lm
examples/lines3d.cpp: In function ‘int main()’:
examples/lines3d.cpp:24:33: error: no matching function for call to ‘plot3(std::vector<double>&, std::vector<double>&, std::vector<double>&, std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >&)’
24 | plt::plot3(x, y, z, keywords);
| ^
In file included from examples/lines3d.cpp:1:
examples/../matplotlibcpp.h:586:6: note: candidate: ‘template<class Numeric> void matplotlibcpp::plot3(const std::vector<Numeric>&, const std::vector<Numeric>&, const std::vector<Numeric>&, long int, const std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >&)’
586 | void plot3(const std::vector<Numeric> &x,
| ^~~~~
examples/../matplotlibcpp.h:586:6: note: template argument deduction/substitution failed:
examples/lines3d.cpp:24:25: note: cannot convert ‘keywords’ (type ‘std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >’) to type ‘long int’
24 | plt::plot3(x, y, z, keywords);
| ^~~~~~~~
make: *** [Makefile:38: examples/build/lines3d] Error 1
我已经尝试为此安装和所有必要的 python 库,但到目前为止还没有锁定。任何人都可以看到问题出在哪里?
谢谢。
解决方案
您不必构建任何东西来安装 matplotlib-cpp:
库的 C++ 部分由
matplotlibcpp.h
可以放在任何地方的单个头文件组成。
既然你在 Arch,我会使用matplotlib-cpp-git AUR 包。它只是将单个头文件安装到/usr/include/matplotlib-cpp/matplotlibcpp.h
,但走 AUR 路线意味着该文件将被pacman
.
推荐阅读
- gem5 - X86 DerivO3CPU CPI 问题
- plsql - 格式化 SQL WHERE 条件值
- python - 使用 Gekko 优化自行车配速策略,收敛到局部不可行点
- c - 如何在C中读取文件时将光标移到开头
- python - 为什么在我的 OpenCV 车道检测中 Python (int) 对于 C 来说太大了?
- sql - 在值随组更改之前找到的行数
- python - 网络抓取中的错误是什么?
- sql - 如何在流入数据库中使用 WHERE 子句进行查询?
- terraform - 为 kubernetes_role 资源构建动态 terraform 字段
- c++ - cin.fail 与我的 while 循环是否导致我的输出无限循环?