我想用 C++ 运行 Python 脚本。
在我的书中,有以下内容:
#include <Python.h>
... at main function some calls
但是编译时Compiler找不到Python头文件。
我该如何解决这个问题?
最佳答案
在 Linux Mint 上 sudo apt-get install python-dev
应该可以完成这项工作。这将获取并安装 python 开发文件。
这应该将包含文件放在 /usr/include/python2.7/
中,因此您需要添加 -l/usr/include/python2.7/
到你的编译器标志。
`
关于python - C++ 嵌入 Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22132314/