Cannot install JPype on ubuntu 12.04 64 bit

2019-08-09 02:44发布

问题:

Well, I followed the instructions here, but I get a compilation error when running setup.py

src/native/common/jp_voidtype.cpp: In member function ‘virtual void JPVoidType::setArrayValues(jarray, HostRef*)’:
src/native/common/jp_voidtype.cpp:105:2: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default]
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/python/jpype_python.cpp:18:0:
src/native/python/include/jpype_python.h:24:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

So as you can see I get a lot of deprecated warning (that I didn't post) like in the first two lines, but then there's a critical error - the missing Python.h file - that makes the installation fail.

How do I go about fixing it? Where should I put this file?

Note: my JAVA_HOME is set correctly to /usr/lib/jvm/java-7-oracle/

回答1:

The command:

sudo apt-get install python-jpype

Worked for me.