找不到文件 <Python.h>

Cannot find file <Python.h>

本文关键字:gt Python lt 文件 找不到      更新时间:2023-10-16

我使用的是Xcode。我在这个新mac上遇到了一个错误:'Python.h' file not found.在线:#include <Python.h>

当我在命令行中键入sudo find / -name "Python.h"时,我可以看到它存在相当多的版本,甚至在Xcode中也是如此。

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h find: /dev/fd/3: Not a directory find: /dev/fd/4: Not a directory /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h /System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h

有人知道发生了什么事吗?是我没有正确设置Xcode吗?

您需要设置'Python.h'存在的include路径。

有关详细操作,请参阅以下URL中的"如何在xcode项目中设置包含路径"问题。

如何在xcode项目中设置包含路径