R - 无法安装 R 包 - 无法打开连接 [英] R - Unable to install R packages - Cannot open the connection

查看:147
本文介绍了R - 无法安装 R 包 - 无法打开连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将其标记为重复之前,我想说我已经参考了相关的 post 1,帖子 234

Before you mark this as duplicate, I wish to say that I already referred the related post 1,post 2, 3, 4

我正在尝试安装 dplyrstringr 包,但出现以下错误

I am trying to install the dplyr and stringr package but i get the below error

Warning in install.packages :
  downloaded length 139264 != reported length 3227450
Warning in install.packages :
  error 1 in extracting from zip file
Warning in install.packages :
  cannot open compressed file 'dplyr/DESCRIPTION', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection

我尝试了不同的安装命令,例如

I tried different installation commands like

install.packages("dplyr")
install.packages("dplyr",  repos="http://cran.us.r-project.org")
install.packages("dplyr",  repos="http://cran.us.r-project.org",type="win.binary")

> Sys.info()
       sysname        release        version         machine 
     "Windows"       "10 x64"  "build 17134"        "x86-64" 
> version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          6.2                         
year           2019                        
month          12                          
day            12                          
svn rev        77560                       
language       R                           
version.string R version 3.6.2 (2019-12-12)
nickname       Dark and Stormy Night 

直到昨天,我才能成功安装这个包.但是今天它抛出了这个错误.

Till yesterday, I was able to install this package successfully. But today it is throwing this error.

这个错误也发生在其他包中,比如 stringr.我也尝试更改 CRAN 镜像,但仍然没有帮助

This error happens with other packages like stringr as well. I tried chaging CRAN mirrors as well but still no help

可以帮忙吗?

推荐答案

发生此错误的原因通常是 R 无法访问用于安装软件包的默认目录.此错误是与系统相关的错误.试试这个解决方案.它对我有用.我在环境变量中更改了默认安装目录,运行顺利.

This error typically happens because R cannot access the default directory for installing the packages. This error is a system-related error. Try this solution. It worked out for me. I changed the default installation directory in the environment variables and it worked smoothly.

这篇关于R - 无法安装 R 包 - 无法打开连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆