Ssuching Yu
Ssuching Yu

Reputation: 315

C1083 Cannot open include file: "Python.h": No such file or directory

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.

Upvotes: 2

Views: 17605

Answers (1)

Ssuching Yu
Ssuching Yu

Reputation: 315

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.

Upvotes: 2

Related Questions