【问题标题】:Boost Python "cannot open source file 'pyconfig.h'" when importing using "#include <boost\python.hpp>"使用“#include <boost\python.hpp>”导入时,Boost Python“无法打开源文件'pyconfig.h'”
【发布时间】:2019-10-14 11:15:23
【问题描述】:

我正在尝试将 Boost Python 用于一个项目。我已经在 Windows 10 上下载并构建了 1.70 版,并且我正在使用 Visual Studio Code。尝试使用以下行将 boost 导入我的 c++ 项目时:

#include <boost\python.hpp>

,我收到以下错误:

cannot open source file "pyconfig.h" (dependency of "boost\python.hpp")

我已经研究过类似的问题,我发现的主要解决方案是编辑 user-config.jam 以包含我的 python 安装位置。我已经这样做了,user-config.jam 中的行如下所示:

using python : 3.7 : C:\Users\broke\AppData\Local\Programs\Python\Python37 ;

添加此行后,我重新构建了 Boost Python。这并没有解决这个问题。我将不胜感激在这件事上的帮助。谢谢。

【问题讨论】:

    标签: python c++ boost boost-python


    【解决方案1】:

    您需要确保将python/include 文件夹添加到您的包含中。 C:\Python\Python37\include 在 Windows 上为我服务。您还需要链接 python 库。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-08-13
      • 2019-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-05
      相关资源
      最近更新 更多