【问题标题】:trouble installing matplotlib-cpp安装 matplotlib-cpp 时遇到问题
【发布时间】:2021-03-26 08:25:12
【问题描述】:

您好,我正在尝试在 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 库,但到目前为止还没有锁定。谁能看出问题出在哪里?

谢谢。

【问题讨论】:

    标签: c++ matplotlib installation cmake


    【解决方案1】:

    你不应该为 install matplotlib-cpp 构建任何东西:

    库的 C++ 部分由单个头文件 matplotlibcpp.h 组成,可以放在任何地方。

    既然你在 Arch,我会使用 matplotlib-cpp-git AUR package。它只是将单个头文件安装到/usr/include/matplotlib-cpp/matplotlibcpp.h,但走 AUR 路线意味着该文件将被pacman 跟踪。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-11
      • 2011-10-17
      • 2013-12-24
      • 2020-02-27
      • 2018-02-25
      • 2011-06-06
      相关资源
      最近更新 更多