如何在OS X Lion上安装JPype以与Neo4j一起使用? [英] How to install JPype on OS X Lion to use with Neo4j?

查看:126
本文介绍了如何在OS X Lion上安装JPype以与Neo4j一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试将Neo4j用于一个项目,并且希望通过Python与它进行交互,因为我是编程的新手,并且不知道任何Java。我遵循安装说明,但我是卡在
第一步,即安装JPype。



我使用的是OS X 10.7(狮子)。我认为我的配置是非常标准的
,Python 2.7.2从Python网站下载,Java 1.6.0从Apple网站下载。



当我运行

 %sudo python setup.py install 

在JPype安装程序中,我得到了关于各种.h文件的100行错误代码,然后
以行结束:

  lipo:找不到以下架构类型:/ var / tmp // 
ccwOzLi9.out

错误:我发现一个有关JPype的gcc错误的博客文章,但我按照指示那里无济于事。我还发邮件给这个职位的作者,他告诉我从来没有实际使用JPype,一直在OS X 10.6中工作,并没有任何见识。



我还通过电子邮件发送了JPype的创建者,他告诉我他只使用Windows,并且不知道如何在OS X上进行安装。但是如果我们能解决这个问题,我可以指出他的答案,也许他可以添加JPype文档的解决方案,并帮助其他人!



那么,有谁知道我做错了什么?我想使用Neo4j,但是我
不知道Java,所以我完全丧失了如何修复编译器
的错误。



基于阅读所有可用的Google结果,我的两个运行
理论是:


  1. 我是以某种方式使用32位版本的Python或Java(尽管I
    使用标准官方安装,并且无法弄清楚如何将
    切换到64位或甚至可能)


  2. JPype文件只能使用GCC 4.0而不是4.2编译。
    但我在网上找不到有关如何回滚到GCC 4.0的任何信息(或者如果它附带2011 MacBooks附带的
    ,并且有一些方法可以强制
    JPype编译) 。

  3. 安装问题>另一个类似的问题,但是解决方案是使用不同的适配器,而不是直接连接到Java。我会尝试,如果我必须的话,但如果可能的话,我真的会更愿意使用推荐的Neo4j方法。

我不是一个Python家伙,但试着在我的机器上安装JPype:

$ p $%$ uname -a
Darwin fat-i7 .local.tld 11.2.0 Darwin内核版本11.2.0:8月9日20:54:00 PDT 2011;根目录:xnu-1699.24.8〜1 / RELEASE_X86_64 x86_64
%java -version
Java版本1.6.0_29
Java™SE运行时环境(build 1.6.0_29-b11-
Java HotSpot™64位服务器虚拟机(构建20.4-b02-402,混合模式)

在OSX Lion上,最新的JDK似乎位于此处:

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

这篇文章: http://blog.y3xz.com/ post / 5037243230 / installed-jpype-on-mac-os-x



我按照这些指示修改setup.py,然后运行 sudo python setup.py install 没有问题。



这有帮助吗?


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.

解决方案

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?

这篇关于如何在OS X Lion上安装JPype以与Neo4j一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆