R包安裝失敗并出現(xiàn)“ had non-zero exit status”報(bào)錯(cuò)解決辦法

問(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’
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容