python - 在 C++ 中嵌入 Python 时我要链接到什么

标签 python c++ visual-c++ python-3.x python-3.3

我需要链接到什么,以便我可以在 C++ 中使用 Py_Initilize 和 Py_SimpleString 以及其他东西?

我在 Windows 7 64 位上使用 vs 2012。我正在编译为 win32(我认为)并且我有 32 位 python33。我确实查看了 Python 文档,但没有找到任何关于针对 windows 的编译和链接的内容,仅针对 linux。

那么如何链接到 python 呢?

我是否需要使用外部库将 Python 嵌入到我的 C++ 应用程序中?

我计划使用 C++ 应用程序作为启动器,以启动调用不同类/模块的 python 脚本。我仍在学习 Python,但我知道一些 C++。

最佳答案

您需要在 python 安装目录中链接 python33.lib。您还需要将 python install dir/include 目录添加到 #include <Python.h> 的库路径中。上类。

您需要阅读 this首先,我认为您应该下载 python 代码并尝试那里的示例(在 PC 目录下)。

关于python - 在 C++ 中嵌入 Python 时我要链接到什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21265487/

相关文章:

c++ - Boost::multi_array——引用太慢

python - Scrapy爬行蜘蛛只触摸start_urls

python - 使用for循环时索引越界

c++ - 编译时检查以确保结构中的任何地方都没有填充

c# - 具有相同类类型成员的类

c - 如何在 MSVC++6 中声明 'ilogbf' 等 IEEE 数学函数?

python - 获取 Path 对象的 "true"主干的干净方法?

python - Django - 以形式访问request.session

c++ - R 和 C++ 迭代

c++ - Visual C++ 编译器允许从属名称作为没有 "typename"的类型?