我正在尝试学习如何使用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。上运行它。
答案 0 :(得分:0)
好的,所以我自己弄清楚了,但我认为这可能对其他人有帮助。长话短说,仔细阅读输出。输出显示:
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 Runtime Environment
2. $ sudo apt-get install -y default-jdk
安装Java开发工具包
3. $ sudo R CMD javareconf
告诉R在哪里找到东西
4.然后在R中,> install.packages("rJava")
5. > install.packages("openNLP")
应该可以。