問(wèn)題描述:
R包安裝中出現(xiàn)諸如“non-zero exit status”情況的報(bào)錯(cuò)信息,
雖然退出R后再library中手動(dòng)刪除R包,但是仍然無(wú)法奏效。
筆者參考以下兩篇文章問(wèn)題得以解決。
installation of package ‘blob’ had non-zero exit status
R install.packages returns “failed to create lock directory”
問(wèn)題報(bào)錯(cuò)
install.packages("backports")
There is a binary version available but the source version is later:
binary source needs_compilation
backports 1.1.7 1.1.8 TRUE
installing the source package ‘backports’
試開URL’https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/backports_1.1.8.tar.gz'
Content type 'application/x-gzip' length 18047 bytes (17 KB)
downloaded 17 KB
ERROR: failed to lock directory 'C:/software/R/R-4.0.2/library' for modifying
Try removing 'C:/software/R/R-4.0.2/library/00LOCK-backports'
Warning in install.packages :
installation of package ‘backports’ had non-zero exit status
解決方法:
This happens when your last package installation has interrupted abnormally. to fix this you should remove the locked file. For example Execute this command in R console(刪除這個(gè)lock的文件):
意思就是上一次安裝被異常打斷了,為了解決這個(gè)問(wèn)題,必須要手動(dòng)刪除這個(gè)locked文件。
unlink("C:/software/R/R-4.0.2/library/00LOCK-backports", recursive = TRUE).
install.packages("backports")
The downloaded source packages are in ‘C:\Users\Administrator\AppData\Local\Temp\RtmpoX81A2\downloaded_packages’