首页 > 解决方案 > 在 C++Builder 应用程序中嵌入 Python

问题描述

我的项目是将 Python 嵌入到 C++Builder 应用程序中。我正在使用 Python 3.6。

Include在 System Include 路径中添加了 Python 的文件Libs夹,在 Library 路径中添加了 Python 的文件夹:

工具 > 环境选项 > C++ 选项 > 路径和目录

这里是MyUnit1.cpp

#include <vcl.h>
#include <Python.h>
#pragma hdrstop

#include "Unit1.h"
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
  {
  }

但我得到这个错误:

[bcc32 错误] Unit1.cpp(4): E2209 无法打开包含文件“Python.h”

标签: pythonc++c++builder

解决方案


推荐阅读