#include <Python.h> no such file or directory for windows 10 fix

Viewed 1168

I am trying to build an extension in C for python 3 and I am using Windows. This might be a duplicate question but all the answers for the other question were for linux and I can run sudo on windows. How do I fix this problem ?

2 Answers

Nevermind, I found the answer. You must first search in your python directory for the 'include' folder, for example: "C:\Users\David\AppData\Local\Programs\Python\Python38-32\include", this is where mine is located and then search for Python.h and like that, you have the header.

If the problem is just the sudo-thing, you can have an admin-Terminal easily. Open your start menu, search for PowerShell, right click -> run as admin With Powershell you can use most important UNIX-commands.

If your IDE or Text Editor does not find a header file like the reason most likely is that this cpp-Header is either not installed or the Path to is not defined. Look for sth like "include-path" in your IDE´s Settings.

Related