我一直在尝试在 OS X 10.10.1 上安装 pyjnius。其他依赖项处理完毕,我一直无法解决找不到头文件“jni.h”的问题。这是发生的事情:
$ sudo python setup.py install
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running install
running build
running build_py
running build_ext
skipping 'jnius/jnius.c' Cython extension (up-to-date)
building 'jnius' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c jnius/jnius.c -o build/temp.macosx-10.10-intel-2.7/jnius/jnius.o
jnius/jnius.c:238:10: fatal error: 'jni.h' file not found
#include "jni.h"
^
1 error generated.
error: command 'cc' failed with exit status 1
[如果有什么不同,我尝试使用 pip,但它以相同的错误终止。]
安装的 Java 版本是 1.6.0.65 和 1.8.0.25。如果需要,我可以在它们之间切换。
如果有帮助,我可以找到jni.h
using locate
. 它位于此处:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/jni.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/jni.h
/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/include/jni.h
任何帮助将不胜感激!