【发布时间】:2012-11-22 16:02:32
【问题描述】:
关于 Python 的 setuptools 的问题。我刚刚全新安装了 Mac OS 10.8 并安装了官方 Python 2.7.3 包。安装二进制模块py-bcrypt(或任何其他二进制模块)时,出现以下错误:
bcrypt/bcrypt_python.c:17:10: fatal error: 'Python.h' file not found
#include "Python.h"
^
1 error generated.
error: Setup script exited with error: command 'clang' failed with exit status 1
运行 sudo easy_install --verbose py-bcrypt 显示以下对 CLang 的调用:
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c bcrypt/bcrypt_python.c -o build/temp.macosx-10.8-intel-2.7/bcrypt/bcrypt_python.o
...除了这部分之外很好:
-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
因为Python.h这里其实存放在非-系统库中:/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h
所以最后切入正题:如何更改 setuptools 使用的默认包含路径?
【问题讨论】:
标签: python macos clang setuptools easy-install