Installing Stanford Parser's Python interface:

2019-08-29 07:49发布

问题:

I'd like to install the stanford parser's python interface.

http://projects.csail.mit.edu/spatial/Stanford_Parser

When running rake setup to install jpype first, I keep ge

In file included from src/native/common/jp_reference.cpp:1:0:
src/native/common/include/jpype.h:45:17: schwerwiegender Fehler: jni.h: Datei oder     Verzeichnis nicht gefunden
Kompilierung beendet.
error: command 'gcc' failed with exit status 1
rake aborted!

The error message is english-german-mixed. It says: heavy failure: jni.h: File or directory not found.

When I try to install the stanford-parser itself, the same thing happens.

Yes, I python-dev is already installed on my system. I'm working on Ubuntu and with python2.7.

回答1:

The error messages says you are missing jni.h. You can use the search tool at http://packages.ubuntu.com to find which package provides the missing file:

For the most recent version of Ubuntu, Quantal (12.10), these packages provide the jni.h:

File    Packages
/usr/lib/gcc-snapshot/lib/gcc/i686-linux-gnu/4.8.0/include/jni.h    gcc-snapshot
/usr/lib/gcc/i686-linux-gnu/4.6/include/jni.h   gcj-4.6-jdk
/usr/lib/gcc/i686-linux-gnu/4.7/include/jni.h   gcj-4.7-jdk
/usr/lib/jvm/java-1.5.0-gcj-4.6/include/jni.h   gcj-4.6-jdk
/usr/lib/jvm/java-1.5.0-gcj-4.7/include/jni.h   gcj-4.7-jdk
/usr/lib/jvm/java-1.5.0-gcj-4.8-snap/include/jni.h  gcc-snapshot
/usr/lib/jvm/java-6-openjdk-i386/include/jni.h  openjdk-6-jdk
/usr/lib/jvm/java-7-openjdk-i386/include/jni.h  openjdk-7-jdk

Either openjdk or gcj will do; this page may help clarify the difference.



回答2:

jni.h is the Java Native Interface header, so you will need to make sure you have Java installed. For Ubuntu there is a openjdk-6-jdk package which I've confirmed has the require file available.