IT干货网

r之安装r包代码工具时出错

over140 2024年11月24日 编程设计 62 0

我尝试更新 codetools 包并在使用 update.package() 或 install.package() 时遇到相同的错误,如下所示。任何见解都值得赞赏:

R> install.packages("codetools", lib = "/usr/lib/R/library") 
trying URL 'https://cran.rstudio.com/src/contrib/codetools_0.2-14.tar.gz' 
Content type 'application/x-gzip' length 12938 bytes (12 KB) 
================================================== 
downloaded 12 KB 
 
* installing *source* package ‘codetools’ ... 
** package ‘codetools’ successfully unpacked and MD5 sums checked 
mv: cannot move ‘/usr/lib/R/library/codetools’ to ‘/usr/lib/R/library/00LOCK-codetools/codetools’: Permission denied 
Warning in file.copy(f, instdir, TRUE) : problem copying ./NAMESPACE to /usr/lib/R/library/codetools/NAMESPACE: Permission denied 
Warning in file(file, ifelse(append, "a", "w")) : cannot open file '/usr/lib/R/library/codetools/DESCRIPTION': Permission denied 
Error in file(file, ifelse(append, "a", "w")) : cannot open the connection 
ERROR: installing package DESCRIPTION failed for package ‘codetools’ 
* removing ‘/usr/lib/R/library/codetools’ 
Warning in install.packages : installation of package ‘codetools’ had non-zero exit status 
 
The downloaded source packages are in 
‘/tmp/RtmpiJWb8L/downloaded_packages’ 
Updating HTML index of packages in '.Library' 
Warning in install.packages : cannot create file '/usr/share/R/doc/html/packages.html', reason 'Permission denied' 
Warning in install.packages : cannot update HTML package index 

请您参考如下方法:

权限被拒绝听起来好像您没有该系统的管理员权限。尝试以 root 身份运行 R(或使用 sudo),看看它是否有效。


评论关闭
IT干货网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!