gpt4 book ai didi

r - 包 ‘raster’ 的安装具有非零退出状态

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:04:09 35 4
gpt4 key购买 nike

我正在尝试安装包“Raster”,但出现包“raster”的错误安装具有非零退出状态。

我在其他网站看过,没有成功提前谢谢你

我在下面详细说明过程和错误。

install.packages("raster")
Installing package into ‘/home/hectorirc/R/x86_64-pc-linux-gnu-

库/3.4' (因为“lib”未指定) 还安装依赖项‘sp’、‘Rcpp’

probando la URL 'https://cloud.r-project.org/src/contrib/sp_1.3-1.tar.gz'
Content type 'application/x-gzip' length 1133621 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

probando la URL 'https://cloud.r-project.org/src/contrib/Rcpp_0.12.17.tar.gz'
Content type 'application/x-gzip' length 3766351 bytes (3.6 MB)
==================================================
downloaded 3.6 MB

probando la URL 'https://cloud.r-project.org/src/contrib/raster_2.6-7.tar.gz'
Content type 'application/x-gzip' length 1080946 bytes (1.0 MB)
==================================================
downloaded 1.0 MB

* installing *source* package ‘sp’ ...
** package ‘sp’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Rcentroid.c -o Rcentroid.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c gcdist.c -o gcdist.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c pip.c -o pip.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c pip2.c -o pip2.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c sp_xports.c -o sp_xports.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c surfaceArea.c -o surfaceArea.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c zerodist.c -o zerodist.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o sp.so Rcentroid.o gcdist.o init.o pip.o pip2.o sp_xports.o surfaceArea.o zerodist.o -L/usr/lib/R/lib -lR
/bin/bash: línea 2: g++: no se encontró la orden
/usr/share/R/share/make/shlib.mk:6: recipe for target 'sp.so' failed
make: *** [sp.so] Error 127
ERROR: compilation failed for package ‘sp’
* removing ‘/home/hectorirc/R/x86_64-pc-linux-gnu-library/3.4/sp’
Warning in install.packages :
installation of package ‘sp’ had non-zero exit status
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Date.cpp -o Date.o
/bin/bash: g++: no se encontró la orden
/usr/lib/R/etc/Makeconf:168: recipe for target 'Date.o' failed
make: *** [Date.o] Error 127
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/home/hectorirc/R/x86_64-pc-linux-gnu-library/3.4/Rcpp’
Warning in install.packages :
installation of package ‘Rcpp’ had non-zero exit status
ERROR: dependencies ‘sp’, ‘Rcpp’ are not available for package ‘raster’
* removing ‘/home/hectorirc/R/x86_64-pc-linux-gnu-library/3.4/raster’
Warning in install.packages :
installation of package ‘raster’ had non-zero exit status

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

谢谢:)

最佳答案

我认为问题不在于 R,而是缺少构建工具。您需要安装 g++ 编译器,其中 .在 Ubuntu 上,您只需(在命令行 shell 中,而不是在 R 中):

sudo apt-get install build-essential

假设您有安装权限;...但是通过快速网络搜索,Linux Mint 可能会更复杂一些。

关于r - 包 ‘raster’ 的安装具有非零退出状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51146468/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com