我正在尝试在Mountain Lion中安装jpype.我按照本文中建议的所有步骤操作:
How to install JPype on OS X Lion to use with Neo4j?
然而,山狮有一个小故障.我修改了setupMacOSX()函数,如下所示:
/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/JavaVM.framework/
但是当我运行$sudo python setup.py install时,我收到以下错误:
src/native/common/include/jpype.h:45:10: fatal error: 'jni.h' file not found
我在这里找到了jni.h头:
/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/jni.h
但由于jni.h不是Mountain Lion的一部分,我还没想出如何修改setup.py文件来修复bug.有什么建议?
解决方法
这是在运行OSX 10.8.5的系统上.
我修改了JPype-0.5.4.2的setup.py,并在self.includeDirs列表的末尾添加了一个元素,该列表在函数setupInclusion中创建.对于此特定版本的JPype,此函数在第61行声明.
def setupInclusion(self): self.includeDirs = [ self.javaHome+"/include",self.javaHome+"/include/"+self.jdkInclude,"src/native/common/include","src/native/python/include",#I added this line below. The folder contains a jni.h "/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/" ]
最后我运行了pip install~ / Path / To / JPype-folder /并且安装成功了.