c++ - 尝试编译 C 扩展模块时缺少 Python.h

标签 c++ python compilation extending

我正在关注 this tutorial关于如何使用 C\C++ 代码扩展 Python。

名为“使用 GCC 为 Microsoft Windows 构建扩展模块”的部分对我来说失败并出现以下错误:

fatal error: Python.h: No such file or directory

名为“使用 Microsoft Visual C++ 构建扩展模块”的部分也因类似错误而失败:

fatal error C1083: Cannot open include file: 'Python.h': No such file or directory

我应该怎么做才能解决这个问题?

最佳答案

对于Linux、Ubuntu用户,解决编译时缺少Python.h的问题,只需在终端执行以下命令安装python的开发包即可:

在终端中:sudo apt-get install python-dev

祝你好运

关于c++ - 尝试编译 C 扩展模块时缺少 Python.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4097339/

相关文章:

memory - gcc:设备上没有剩余空间?

c++ - 如何专门化 std::vector<T> 的模板成员函数

c++ - C 或 C++ 中用于数字的二次方的一元运算符

Python字典到html表

python - 函数创建的所有生成器共享值的最佳方式是什么?

c++ - 内联公共(public)接口(interface)的方法

c++ - 通过函数指针定义 "main"

c++ - (如何)当 std::future 准备好时,我可以在 boost::asio::io_service 上获得回调吗?

python - Django:重复过滤查询集的最有效方法

eclipse - julia源码中jl_value_t的含义