python - 在 python 中加载自定义 dll 时出现依赖性错误,使用 Visual Studio 2017 和 boost 构建

标签 python c++ boost dll visual-studio-2017

我正在尝试构建 BGSLibrary来自 C++ 的 python 模块和 boost 源代码。该库在 linux 上编译没有问题。对于 Windows,我使用的是 Visual Studio 2017 和 Cmake 3.9。这是我的步骤。

  1. Visual Studio 安装选项 image

  2. 从 Visual Studio 命令行终端下载 Boost、安装脚本

    bootstrap.bat

    b2 -j%cores% toolset=msvc-14.1 address-model=32 architecture=x86 link=static threading=multi runtime-link=static --build-type=complete stage --with-python

    1. 将 boost_python-vc141-mt-s-1_64.lib 重命名为 python_boost.lib 以满足 cmake 要求。
  3. CMake 配置选项 image

  4. Visual Studio 外部包含目录 image

  5. Visual Studio 外部库目录 image

  6. 将最初命名为 boost_python-vc141-mt-s-1_64.lib 的拷贝移动到 bgs 构建文件夹。

  7. 执行 Visual Studio 构建。它成功创建了 libbgs python dll enter image description here

  8. 根据这个question我将 libbgs.dll 重命名为 .pyd 并在文件夹中包含 boost 库。我将 bgslibrary/build 添加到路径中。不幸的是,还没有完全实现。

image

一些依赖性问题。快速查看 DependencyWalker 非常吓人,问题数量巨大。

enter image description here

在我尝试将所有这些 .dll 手动手动添加到 bgslibrary/build 文件夹之前,我是否遇到了更高级别的错误。我是否应该在 visual studio 的一般属性中选择“静态库”,这会有什么不同吗?

最佳答案

已解决。 Dependency walker 已经足够老了,它只是显示了很多错误。真的只是 4 个 opencv dll。将 opencv/build/release/bin 添加到我的路径中即可。

关于python - 在 python 中加载自定义 dll 时出现依赖性错误,使用 Visual Studio 2017 和 boost 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45048188/

相关文章:

c++ - 如何知道 MPI 请求的接收者和发送者

c++ - boost MPL 以生成对象序列化代码?

c++ - 纯虚函数调用

Python 将 Json 行加载到 Pandas Dataframe

python - 导入 matplotlib 和 matplotlib.pyplot 有什么区别?

python - Sockjs - 在 Python 代码中向 sockjs-tornado 发送消息

c++ - popen 管道会减慢其他线程的速度

c++ - 指针递增和递减

c++ - 无法从/dev/input/eventx 读取原始键盘事件

c++ - ALSA 回调(SIGIO 处理程序)有时会在 boost::posix_time::microsec_clock::local_time() 中的某处挂起