[英]#include <Python.h> no such file or directory for windows 10 fix
I am trying to build an extension in C for python 3 and I am using Windows.我正在尝试在 C 中为 python 3 构建扩展,并且我正在使用 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.这可能是一个重复的问题,但其他问题的所有答案都是针对 linux 的,我可以在 windows 上运行 sudo。 How do I fix this problem?我该如何解决这个问题?
If the problem is just the sudo -thing, you can have an admin-Terminal easily.如果问题只是sudo -thing,您可以轻松拥有一个管理员终端。 Open your start menu, search for PowerShell, right click -> run as admin With Powershell you can use most important UNIX-commands.打开开始菜单,搜索 PowerShell,右键单击 -> 以管理员身份运行 使用 Powershell,您可以使用最重要的 UNIX 命令。
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.如果您的 IDE 或文本编辑器找不到 header 文件,原因很可能是未安装此 cpp-Header 或未定义路径。 Look for sth like "include-path" in your IDE´s Settings.在 IDE 的设置中寻找类似“include-path”的东西。
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.您必须首先在 python 目录中搜索“include”文件夹,例如:“C:\Users\David\AppData\Local\Programs\Python\Python38-32\include”,这是我所在的位置,然后搜索对于 Python.h 等,您拥有 header。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.