致命错误:安装 Couchapp 时找不到'Python/Python.h'文件



我正在尝试从macOS High Sierra上的终端安装couchapp

我安装了python 2.7.10(默认情况下(,并根据couchapp文档运行$ pip2 install couchapp

这是我得到的错误:

src/watchdog_fsevents.c:22:10: fatal error: 'Python/Python.h' file not found
    #include <Python/Python.h>
             ^~~~~~~~~~~~~~~~~
    1 error generated.
    error: command 'cc' failed with exit status 1
 ----------------------------------------
  Failed building wheel for watchdog
这是我在/

System/Library/Frameworks/Python.framework/中$ ls时所拥有的

  • 例子
  • 模块
  • 资源
  • 版本
  • 模块映射

到目前为止我尝试过:

  1. 检查 Xcode CL Tools 是否已在运行$ xcode-select --install
  2. 尝试使用 pip3 而不是 pip2(我已经用自制软件安装了 python 3.6(,但我收到相同的错误消息。

你有什么想法吗?我读过其他帖子,但它们没有解决我的问题。

谢谢

在我的High Sierra(10.13.5(设置中遇到了非常相似的问题,安装了Xcode CLI工具;对我来说,Python.h是在/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7中找到

(一些资源说可以通过find /usr/local/Cellar/ -name Python.h找到该位置,但是如果您的python没有与brew一起安装,这似乎不起作用。

将位置添加到 C 包含路径,或在编译时通过设置 -I 标志作为标志:-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 .

让我绊倒的部分是导入语句应该看起来像这样:如果你的 Python.h 直接在 python2.7 目录中,#include <Python.h>而不是#include <Python/Python.h>

希望有帮助,

最新更新