Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
266 views
in Technique[技术] by (71.8m points)

java - How to install JPype on OS X Lion to use with Neo4j?

I am trying to use Neo4j for a project, and want to interface with it through Python since I'm a newbie to programming and don't know any Java. I'm following the installation instructions, but I'm stuck on the first step, which is to install JPype.

I'm using OS X 10.7 (lion). I think my configuration is pretty standard with Python 2.7.2 downloaded from the Python website and Java 1.6.0 downloaded from the Apple website.

When I run

% sudo python setup.py install

On the JPype installer, I get about a 100 lines of error code about various .h files, then it terminates with the lines:

lipo: can't figure out the architecture type of: /var/tmp//
ccwOzLi9.out

error: command 'gcc-4.2' failed with exit status 1

I found a blog post about a gcc error with JPype, but I followed the instructions there to no avail. I also emailed the author of that post, and he told me had never actually used JPype, had been working in OS X 10.6, and didn't have any insight.

I also emailed the creator of JPype, who told me that he only uses Windows, and has no idea how to make the install work on OS X. But if we can solve this, I can point him to the answer and maybe he can add the solution to the JPype documentation and help lots of other people as well!

So, anyone know what I'm doing wrong? I would like to use Neo4j, but I don't know Java so I'm at a complete loss for how to fix a compiler error.

Based on reading every Google result available, my two running theories are that:

  1. I'm somehow using a 32-bit version of Python or of Java (though I used standard official installations and can't figure out how to switch to 64-bit or if that's even possible)

  2. The JPype files can only be compiled using GCC 4.0 instead of 4.2. But I can't find anything online about how to rollback to GCC 4.0 (or if it comes shipped with 2011 MacBooks and there is some way to force JPype to compile with that instead).

There is another similar question, but the solution there is to use a different adapter that goes through REST instead of hooking directly into Java. I will try that if I have to, but I would really rather use the recommended Neo4j method if it's possible.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I'm not a Python guy, but tried installing JPype on my machine:

% uname -a
Darwin fatty-i7.local.tld 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug  9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64
% java -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)

On OSX Lion, the latest JDK appears to be located here:

/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/JavaVM.framework/

A little googling turned up this post: http://blog.y3xz.com/post/5037243230/installing-jpype-on-mac-os-x

I followed those instructions to modify setup.py, then ran sudo python setup.py install with no problems.

Does that help?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...