[英]matplotlib for c++ gives this error: 'PyObject_CallObject': function does not take 3 arguments
I have microsoft visual studio 2019 and installed matplotlib for it using nuget but when I want to build this code:我有 microsoft visual studio 2019 并使用 nuget 为其安装了 matplotlib 但是当我想构建此代码时:
#include "matplotlibcpp.h"
namespace plt = matplotlibcpp;
int main() {
plt::plot({ 1,3,2,4 });
plt::show();
}
it gives this error: 'PyObject_CallObject': function does not take 3 arguments
它给出了这个错误:
'PyObject_CallObject': function does not take 3 arguments
this is the build output:这是构建 output:
1>------ Build started: Project: ConsoleApplication3, Configuration: Debug Win32 ------
1>ConsoleApplication3.cpp
1>C:\Users\matthijs\source\repos\ConsoleApplication3\packages\matplotlib-cpp.1.1.0.92\include\matplotlibcpp\imshow.h(58,21): error C2660: 'PyObject_CallObject': function does not take 3 arguments
1>C:\Users\matthijs\source\repos\ConsoleApplication3\packages\matplotlib-cpp.1.1.0.92\sandbox\include\abstract.h(363,29): message : see declaration of 'PyObject_CallObject'
1>C:\Users\matthijs\source\repos\ConsoleApplication3\packages\matplotlib-cpp.1.1.0.92\include\matplotlibcpp\imshow.h(58,40): message : 'PyObject_CallObject': function declaration must be available as none of the arguments depend on a template parameter
1>Done building project "ConsoleApplication3.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
and the full error:和完整的错误:
Severity Code Description Project File Line Suppression State Suppression State
Error C2660 'PyObject_CallObject': function does not take 3 arguments ConsoleApplication3 C:\Users\matthijs\source\repos\ConsoleApplication3\packages\matplotlib-cpp.1.1.0.92\include\matplotlibcpp\imshow.h 58
how to fix this?如何解决这个问题? I used nuget to install the lasted version of matplotlib
我用nuget安装了matplotlib的最新版本
the error happens here: PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_imshow, plot_args, kwargs);
错误发生在这里:
PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_imshow, plot_args, kwargs);
I have a windows 10 laptop and I use python 3.7我有一台 windows 10 笔记本电脑,我使用 python 3.7
As the error says, "PyObject_CallObject" does not take 3 args.正如错误所说,“PyObject_CallObject”不需要 3 个参数。 Looking at some docs I found on a quick google , it looks like your args (plot_args, kwargs) need to be in a tuple - they need to all be within one arg to PyObject_CallObject.
查看我在快速 google 上找到的一些文档,看起来您的 args(plot_args,kwargs)需要在一个元组中 - 它们都需要在 PyObject_CallObject 的一个 arg 中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.