我試圖在Ubuntu 12.04.5 LTS上構建stanford NLP的python界面。 有需要兩個步驟,第一個是:在的3rdParty/jpype運行「耙設置」Stanford CoreNLP python界面安裝錯誤
- 編譯Jpype
在這樣做時,我得到以下錯誤:
In file included from src/native/common/jp_monitor.cpp:17:0:
src/native/common/include/jpype.h:45:17: fatal error: jni.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
rake aborted!
Command failed with status (1): [cd JPype-0.5.4.1 && python setup.py build...]
錯誤消息說我缺少jni.h
,所以建議here如果我運行命令dpkg-query -L openjdk-7-jdk | grep "jni.h"
得到/usr/lib/jvm/java-7-openjdk-amd64/include/jni.h
。
我相信這意味着我的系統上有jni.h
,所以我現在很困惑。什麼導致了錯誤?你能提出任何解決辦法嗎?
感謝您的幫助!
幾個洞察
這裏是指令導致錯誤:
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.08/include -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.08/include/linux -Isrc/native/common/include -Isrc/native/python/include -I/usr/include/python2.7 -c src/native/common/jp_class.cpp -o build/temp.linux-x86_64-2.7/src/native/common/jp_class.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default]
In file included from src/native/common/jp_class.cpp:17:0:src/native/common/include/jpype.h:45:17: fatal error: jni.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
它從所需Python接口的JPype
編譯到來。我不知道爲什麼,但它包含我的文件系統中沒有的路徑(即-I/usr/lib/jvm/java-1.5.0-sun-1.5.0.08/include/linux
)。
如何正確配置這些路徑?
非常感謝你的答案在哪裏!這正是問題所在,唯一的問題是我不知道如何解決問題;)儘管現在管理! – Matteo 2014-11-07 17:44:00