【发布时间】:2018-01-04 08:01:27
【问题描述】:
我正在关注这个帖子:Creating a C++ extension for Python
我已经在我全新的 Windows10LTSB 系统上安装了 VS2017,使用 C++ 和 Python 开发(包括 Python 原生开发工具)工作负载进行桌面开发,遵循 Installing Python support in Visual Studio on Windows
我的 Python 应用程序运行良好。
我在创建核心 C++ 项目 部分停留了将近一天,我在帖子之后创建了 Empty Project 并尝试创建 Python 扩展模块模板。
错误是E1696 无法打开源文件“Python.h”。
我严格按照帖子设置项目属性,绑了好几次,都没有成功。
我的 Python 目录是 C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64,这也是我的 Python 应用程序的默认环境。
我没有安装官方 Python 发行版,因为Python environments 提到 VS 忽略 PYTHONPATH 环境变量。
【问题讨论】:
-
编译器需要知道Python.h的位置。我认为这将由 VStudio - Python 集成来解决。但无论如何,你可以手动去。检查我对第一组 Notes 中最后一个[SO]: Calling Python function with parametrs from C++ project (Visual Studio) 的回答(关于“Build (compile/link)/Run options”)或stackoverflow.com/questions/32156336/…。
标签: python visual-studio visual-c++