boost.python 参数类型不匹配(numpy.int64 -> int)

1 投票
1 回答
4083 浏览
提问于 2025-04-16 08:12

我遇到了这个问题:

Boost.Python.ArgumentError: Python argument types in
    Dirichlet.Observe(int, numpy.int64, float)
did not match C++ signature:
    Observe(unsigned int, unsigned int, double)

看起来差不多吧?

在做了一些替换之后,我发现中间的那个参数有问题。请问我该怎么把numpy.int64转换成int呢?

1 个回答

3

你可以试试...

int(numpyint)

撰写回答