2

I am following this post: Creating a C++ extension for Python

I have installed VS2017 on my fresh new Windows10LTSB system, with Desktop development with C++ and Python Development (including Python native development tools) workloads, following Installing Python support in Visual Studio on Windows

My Python application worked fine.

I stuck at the Create the core C++ project section for almost a day, I created Empty Project following the post and also tried creating a Python Extension Module template.

The error is E1696 cannot open source file "Python.h".

I strictly followed the post to set up the project property and tied several times, but it did not work at all.

My Python directory is C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64, which was also my Python application's default environment.

I have not installed the official Python distribution, because Python environments mentions that VS ignore PYTHONPATH environment variable.

Ssuching Yu
  • 315
  • 1
  • 4
  • 14
  • The compiler needs to know where the location of *Python.h* is. I thought that this would be taken care by the *VStudio* - *Python* integration. But anyway you could go manually. Check my answer to [\[SO\]: Calling Python function with parametrs from C++ project (Visual Studio)](https://stackoverflow.com/questions/47942845/calling-python-function-with-parametrs-from-c-project-visual-studio) the last in the 1st set of **Notes** (the one about "*Build (compile/link)/Run options*") or https://stackoverflow.com/questions/32156336/how-to-include-openssl-in-visual-studio-expres-2012-windows-7-x64. – CristiFati Jan 04 '18 at 08:50

1 Answers1

2

I have included my Python directory, which is

C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64

I had done this before, but another problem occured. I found this post Creating a C++ extension for Python and retarget the C++ project target platform to x64 in the Solution Property and solved the problem.

Ssuching Yu
  • 315
  • 1
  • 4
  • 14