Windows10多R版本环境下R 3.6.1无法访问CRAN仓库求助
R 3.6.1 无法通过CRAN安装包的求助
之前在Windows 10系统上,R 3.6.1(64位)搭配CRAN和Rtools 3.5安装包一直正常,直到安装R 4.3.0和Rtools 4.3后,R 3.6.1再也无法从CRAN安装包。同一系统下R 4.3.0在RStudio中可正常安装新包,我已卸载R 3.6.1、删除库路径并重新安装,问题依旧,报错如下:
Warning: unable to access index for repository https://cran.rstudio.com/src/contrib:
cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES'
已尝试以下解决方案,均无效:
- 禁用“HTTP安全下载方式”
- 更换CRAN仓库
测试操作及结果
- 运行代码:
browseURL("https://cran.rstudio.com/src/contrib/PACKAGES")
浏览器可正常打开显示可用包列表的页面。
- 运行代码:
getOption("repos")
响应结果:
CRAN "https://cran.rstudio.com/" attr(,"RStudio") [1] TRUE
- 运行代码:
install.packages("ggplot2", repos = "https://cloud.r-project.org")
响应结果:
Warning in install.packages : unable to access index for repository https://cran.rstudio.com/src/contrib: cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES' Installing package into ‘C:/Users/userName/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified) Warning in install.packages : unable to access index for repository https://cloud.r-project.org/src/contrib: cannot open URL 'https://cloud.r-project.org/src/contrib/PACKAGES' Warning in install.packages : package ‘ggplot2’ is not available (for R version 3.6.1) Warning in install.packages : unable to access index for repository https://cloud.r-project.org/bin/windows/contrib/3.6: cannot open URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/PACKAGES'
重新安装R 3.6.1后的会话信息
R version 3.6.1 (2019-07-05) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045) Matrix products: default locale: [1] LC_COLLATE=French_Canada.1252 LC_CTYPE=French_Canada.1252 LC_MONETARY=French_Canada.1252 [4] LC_NUMERIC=C LC_TIME=French_Canada.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_3.6.1 tools_3.6.1
内容的提问来源于stack exchange,提问作者lavaman
相关产品推荐
相关产品推荐

