在Mountain Lion中安装jpype [英] Installing jpype in Mountain Lion
问题描述
我正在尝试在Mountain Lion中安装jpype。我按照本文中建议的所有步骤操作:如何在OS X Lion上安装JPype以与Neo4j一起使用?
I am trying to install jpype in Mountain Lion. I followed all the steps suggested in this post: How to install JPype on OS X Lion to use with Neo4j?
然而,Mountain Lion存在一个小故障。我修改了 setupMacOSX()
函数,如下所示:
However, there is a glitch with Mountain Lion. I have modified the setupMacOSX()
function as follows:
/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/JavaVM.framework/
但是当我运行 $ sudo python setup.py install
我收到以下错误:
But when I run $ sudo python setup.py install
I get the following error:
src/native/common/include/jpype.h:45:10: fatal error: 'jni.h' file not found
我在这里找到了jni.h头:
I have located the jni.h header here:
/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/jni.h
但是因为jni.h不属于Mountain Lion,我还没想出如何修改setup.py文件来修复bug。有什么建议吗?
But since jni.h is not part of Mountain Lion, I have not figured out how to modify the setup.py file to fix the bug. Any suggestions?
推荐答案
这是在运行OSX 10.8.5的系统上。
This is on a system running OSX 10.8.5.
我修改了 JPype-0.5.4.2
的setup.py,并在 self.includeDirs $的末尾添加了一个元素c $ c>在函数
setupInclusion
中创建的列表。对于此特定版本的JPype,此函数在第61行声明。
I modified the setup.py for JPype-0.5.4.2
and added an element to the end of the self.includeDirs
list which is created in the function setupInclusion
. This function is declared at line 61 for this particular version of JPype.
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 /
,安装成功。
Finally I ran pip install ~/Path/To/JPype-folder/
and the installation was successful.
这篇关于在Mountain Lion中安装jpype的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!