簡體   English   中英

c++ 的 matplotlib 給出此錯誤:'PyObject_CallObject': function 不占用 3 ZDBC16FB4CAA5BDA882EBD77

[英]matplotlib for c++ gives this error: 'PyObject_CallObject': function does not take 3 arguments

我有 microsoft visual studio 2019 並使用 nuget 為其安裝了 matplotlib 但是當我想構建此代碼時:

#include "matplotlibcpp.h"
namespace plt = matplotlibcpp;
int main() {
    plt::plot({ 1,3,2,4 });
    plt::show();
}

它給出了這個錯誤: 'PyObject_CallObject': function does not take 3 arguments

這是構建 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 ==========

和完整的錯誤:


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      

如何解決這個問題? 我用nuget安裝了matplotlib的最新版本

錯誤發生在這里: PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_imshow, plot_args, kwargs); 我有一台 windows 10 筆記本電腦,我使用 python 3.7

正如錯誤所說,“PyObject_CallObject”不需要 3 個參數。 查看我在快速 google 上找到的一些文檔,看起來您的 args(plot_args,kwargs)需要在一個元組中 - 它們都需要在 PyObject_CallObject 的一個 arg 中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM