Windows 11下安装R语言terra包遇Zip文件下载超时问题求助
Windows 11下安装R语言terra包失败问题
执行安装命令install.packages("terra")后返回如下错误:
> install.packages("terra") Installing package into 'C:/Users/blane/AppData/Local/R/win-library/4.4' (as 'lib' is unspecified) trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.4/terra_1.7-71.zip' Content type 'application/zip' length 39571680 bytes (37.7 MB) downloaded 12.6 MB Error in download.file(url, destfile, method, mode = "wb", ...) : download from 'https://cloud.r-project.org/bin/windows/contrib/4.4/terra_1.7-71.zip' failed In addition: Warning messages: 1: In download.file(url, destfile, method, mode = "wb", ...) : downloaded length 13259769 != reported length 39571680 2: In download.file(url, destfile, method, mode = "wb", ...) : URL 'https://cloud.r-project.org/bin/windows/contrib/4.4/terra_1.7-71.zip': Timeout of 60 seconds was reached Warning in download.packages(pkgs, destdir = tmpd, available = available, : download of package 'terra' failed
预期能成功安装terra包,但因下载超时导致失败。
解决办法
- 延长下载超时时间:执行
install.packages("terra", timeout = 300),将超时时间设置为300秒(5分钟) - 切换国内CRAN镜像:先运行
options(repos = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/")),再执行安装命令,国内镜像下载速度更快 - 本地手动安装:下载对应版本的terra二进制包(zip格式),执行
install.packages("你的本地文件路径/terra_1.7-71.zip", repos = NULL, type = "win.binary")完成安装
内容的提问来源于stack exchange,提问作者Bob Lane
相关产品推荐
相关产品推荐

