I have microsoft visual studio 2019 and installed matplotlib for it using nuget but when I want to build this code:
#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
this is the build 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
the error happens here: 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
As the error says, "PyObject_CallObject" does not take 3 args. 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.