首页 > 解决方案 > 非零存在状态安装 openNLP

问题描述

我正在尝试学习如何使用 openNLP 包在 R 中查找共现。但是,当我运行时,> install.packages(openNLP)我得到以下输出:

Installing package into ‘/home/aos11409/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependencies ‘openNLPdata’, ‘rJava’

trying URL 'https://cloud.r-project.org/src/contrib/openNLPdata_1.5.3-4.tar.gz'
Content type 'application/x-gzip' length 7318770 bytes (7.0 MB)
==================================================
downloaded 7.0 MB

trying URL 'https://cloud.r-project.org/src/contrib/rJava_0.9-11.tar.gz'
Content type 'application/x-gzip' length 675188 bytes (659 KB)
==================================================
downloaded 659 KB

trying URL 'https://cloud.r-project.org/src/contrib/openNLP_0.2-6.tar.gz'
Content type 'application/x-gzip' length 6656 bytes
==================================================
downloaded 6656 bytes

* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/lib/jvm/default-java/bin/java'
archiver    : ''
compiler    : ''
header prep.: ''
cpp flags   : ''
java libs   : ''
configure: error: Java Development Kit (JDK) is missing or not registered in R
Make sure R is configuInstalling package into ‘/home/aos11409/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependencies ‘openNLPdata’, ‘rJava’

trying URL 'https://cloud.r-project.org/src/contrib/openNLPdata_1.5.3-4.tar.gz'
Content type 'application/x-gzip' length 7318770 bytes (7.0 MB)
==================================================
downloaded 7.0 MB

trying URL 'https://cloud.r-project.org/src/contrib/rJava_0.9-11.tar.gz'
Content type 'application/x-gzip' length 675188 bytes (659 KB)
==================================================
downloaded 659 KB

trying URL 'https://cloud.r-project.org/src/contrib/openNLP_0.2-6.tar.gz'
Content type 'application/x-gzip' length 6656 bytes
==================================================
downloaded 6656 bytes

* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/lib/jvm/default-java/bin/java'
archiver    : ''
compiler    : ''
header prep.: ''
cpp flags   : ''
java libs   : ''
configure: error: Java Development Kit (JDK) is missing or not registered in R
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.

If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.

ERROR: configuration failed for package ‘rJava’
* removing ‘/home/aos11409/R/x86_64-pc-linux-gnu-library/3.5/rJava’
Warning in install.packages :
  installation of package ‘rJava’ had non-zero exit status
ERROR: dependency ‘rJava’ is not available for package ‘openNLPdata’
* removing ‘/home/aos11409/R/x86_64-pc-linux-gnu-library/3.5/openNLPdata’
Warning in install.packages :
  installation of package ‘openNLPdata’ had non-zero exit status
ERROR: dependencies ‘openNLPdata’, ‘rJava’ are not available for package ‘openNLP’
* removing ‘/home/aos11409/R/x86_64-pc-linux-gnu-library/3.5/openNLP’
Warning in install.packages :
  installation of package ‘openNLP’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpyeXutE/downloaded_packages’red with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.

If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.

ERROR: configuration failed for package ‘rJava’
* removing ‘/home/aos11409/R/x86_64-pc-linux-gnu-library/3.5/rJava’
Warning in install.packages :
  installation of package ‘rJava’ had non-zero exit status
ERROR: dependency ‘rJava’ is not available for package ‘openNLPdata’
* removing ‘/home/aos11409/R/x86_64-pc-linux-gnu-library/3.5/openNLPdata’
Warning in install.packages :
  installation of package ‘openNLPdata’ had non-zero exit status
ERROR: dependencies ‘openNLPdata’, ‘rJava’ are not available for package ‘openNLP’
* removing ‘/home/aos11409/R/x86_64-pc-linux-gnu-library/3.5/openNLP’
Warning in install.packages :
  installation of package ‘openNLP’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpyeXutE/downloaded_packages’

如果可以让 openNLP 运行,我该怎么做?如果没有,是否有其他包可以在文本字符串中同时出现?

如果有任何帮助,我将从 Ubuntu 18.+ 和 R 3.5.3 运行它。

标签: rpackageinstallation

解决方案


好的,所以,我自己想出了这一点,但我认为它可能对其他人有所帮助。长话短说,仔细阅读输出。输出说:

configure: error: Java Development Kit (JDK) is missing or not registered in R
Make sure R is configuInstalling package into ‘/home/aos11409/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependencies ‘openNLPdata’, ‘rJava’

为了解决我的依赖问题,我打开终端并运行以下行: 1.$ sudo apt-get install -y default-jre安装 Java 运行时环境 2.$ sudo apt-get install -y default-jdk安装 Java 开发工具包 3.$ sudo R CMD javareconf告诉 R 在哪里可以找到东西 4. 然后在 R 中,> install.packages("rJava") 5.> install.packages("openNLP")

那应该行得通。


推荐阅读