Installing jpype in Mountain Lion

2019-03-29 01:40发布

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?

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/

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

I have located the jni.h header here:

/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/jni.h

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?

1条回答
做个烂人
2楼-- · 2019-03-29 02:06

This is on a system running OSX 10.8.5.

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/"
          ]

Finally I ran pip install ~/Path/To/JPype-folder/ and the installation was successful.

查看更多
登录 后发表回答