boostorg / boostorg/python

numpy required for C++ library to work with python bindings

未关闭
#358 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C++
星标
537
派生
223
平均合并
11 小时 22 分钟
30 天内合并 PR
2

描述

I've added Boost python bindings into a C++ library. Calling the initialization method of this C++ library from python will fail if numpy is not imported into python before importing my C++ library. There are no errors but the C++ library spits out it failed to initialize. Why would numpy be required in python for my boost bindings to work with this C++ library? See example below.

C++

```
// Boost imports I'm using
#include
#include
#include
using namespace boost;

static bool InitializePy() {
// Call library initialize here
}

BOOST_PYTHON_MODULE(test_lib)
{
python::def("initialize", InitializePy);
}
```

Python

```
# import numpy
import test_lib
# Without importing numpy, this initialization will fail
test_lib.initialize()
```

I can share more source if anyone would like a look but the way I see it, regardless of what else is being done in C++, numpy needing to be imported in python is odd to me.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。