【问题标题】:Python setup.py build cannot find standard include for gccPython setup.py build 找不到 gcc 的标准包含
【发布时间】:2015-02-27 00:35:06
【问题描述】:

我正在尝试构建一些基于 openmp 的 python 软件 (pynbody)。我可以在我的 mac 笔记本电脑上执行此操作,但是当我在我的 mac 桌面上尝试时,gcc 调用找不到所有 sys 包含(如 _int8.h)。我已经尝试了所有的

python setup.py config -I/...:/...:/...

export C_INCLUDE_PATH=/...:/...:/...

但我总是收到(fatal error: sys/_types/_int8_t.h: No such file or directory)

gcc: pynbody/sph/smooth.cpp
In file included from /usr/local/lib/gcc/x86_64-apple-darwin14.0.0/5.0.0/include/stdint.h:9:0,
                 from /Developer/SDKs/MacOSX10.6.sdk/usr/include/inttypes.h:255,
                 from /Applications/Canopy.app/appdata/canopy-1.5.2.2785.macosx-x86_64/Canopy.app/Contents/include/python2.7/pyport.h:9,
                 from /Applications/Canopy.app/appdata/canopy-1.5.2.2785.macosx-x86_64/Canopy.app/Contents/include/python2.7/Python.h:58,
                 from pynbody/sph/kd.h:4,
                 from pynbody/sph/smooth.h:5,
                 from pynbody/sph/smooth.cpp:6:
/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/5.0.0/include-fixed/stdint.h:27:32: fatal error: sys/_types/_int8_t.h: No such file or directory
compilation terminated.
In file included from /usr/local/lib/gcc/x86_64-apple-darwin14.0.0/5.0.0/include/stdint.h:9:0,
                 from /Developer/SDKs/MacOSX10.6.sdk/usr/include/inttypes.h:255,
                 from /Applications/Canopy.app/appdata/canopy-1.5.2.2785.macosx-x86_64/Canopy.app/Contents/include/python2.7/pyport.h:9,
                 from /Applications/Canopy.app/appdata/canopy-1.5.2.2785.macosx-x86_64/Canopy.app/Contents/include/python2.7/Python.h:58,
                 from pynbody/sph/kd.h:4,
                 from pynbody/sph/smooth.h:5,
                 from pynbody/sph/smooth.cpp:6:
/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/5.0.0/include-fixed/stdint.h:27:32: fatal error: sys/_types/_int8_t.h: No such file or directory
compilation terminated.
error: Command "/usr/local/bin/gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -DNDEBUG -g -O3 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -UDEBUG -I/usr/local/Canopy_64bit/User/lib/python2.7/site-packages/numpy/core/include -I/Applications/Canopy.app/appdata/canopy-1.5.2.2785.macosx-x86_64/Canopy.app/Contents/include/python2.7 -c pynbody/sph/smooth.cpp -o build/temp.macosx-10.6-x86_64-2.7/pynbody/sph/smooth.o -ftree-vectorize -fno-omit-frame-pointer -funroll-loops -fprefetch-loop-arrays -fstrict-aliasing -g -DKDT_THREADING" failed with exit status 1

我的想法已经用完了...有人知道如何让 python 查看一组用户指定的包含目录吗?

【问题讨论】:

  • 运行xcode-select --install - 看来您缺少一些工具。
  • 我试过...命令行工具已安装,并且包含在那里。但是python并没有找到它们……它只在一个地方寻找。 -- /usr/local/lib/gcc/x86_64-apple-darwin14.0.0/5.0.0/include

标签: python gcc include-path setup.py


【解决方案1】:

使用 Finder 查看您是否还有标题。如果这样做,则需要将 sys 目录的位置添加到包含路径中。

【讨论】:

  • 我有文件...在多个地方:/usr/local/include、/usr/include ... 以及一些 /Application 和 /Library 目录下...包括路径? python configure -I/... 没有用... export C_INCLUDE_PATH 也没有。
【解决方案2】:

您可以在 setup.cfg 中调整这些目录。

【讨论】:

  • 欢迎来到 Stack Overflow!请考虑编辑您的答案以包含更多详细信息,一个示例可能会有所帮助,或者指出 setup.cfg 中需要调整的确切部分也可以使您的答案更有帮助。
猜你喜欢
  • 2011-01-09
  • 2017-11-26
  • 1970-01-01
  • 2012-02-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多