问题描述
在将用户的全部权限授予R文件夹之后,我正在Windows 7上使用R 2.13.0(如此处).这样我就可以安装新软件包了.
I am using R 2.13.0 with windows 7, after giving my user full privileges to the R folder (as described here).This allows me to install new packages just fine.
但是,当使用update.packages()更新现有软件包时,我不断收到以下错误消息(例如,更新MASS软件包时):
However, when using update.packages(), to update existing packages, I keep getting the following error (for example, when updating the MASS package):
警告:无法移动临时安装 'C:\ Program Files \ R \ R-2.13.0 \ library \ file6cae3bcf \ MASS' 到'C:\ Program Files \ R \ R-2.13.0 \ library \ MASS'
Warning: unable to move temporary installation 'C:\Program Files\R\R-2.13.0\library\file6cae3bcf\MASS' to 'C:\Program Files\R\R-2.13.0\library\MASS'
关于如何解决此问题的任何建议?
Any suggestions on how to fix this?
p.s:以管理员身份运行R或将库位置移出程序文件"不是解决方案(这是hack,但我正在寻找解决方案)
p.s: Running R as an administrator or shifting the library location out of Program Files is not a solution (it's a hack - but I am looking for a solution)
推荐答案
我发现问题确实出在防病毒实时文件系统保护"上.我执行以下操作来解决该问题:
I found that the problem indeed is the antivirus "real time file system protection". I do the following to fix the problem:
trace(utils:::unpackPkgZip, edit=TRUE)
我编辑第140行(R 3.4.4中的第142行):
I edit line 140 (line 142 in R 3.4.4):
Sys.sleep(0.5)
收件人:
Sys.sleep(2)
我似乎杀毒软件停止了软件包tmp dir的创建.将其更改为2秒后,错误消失了.
I seems like the antivirus stalls the creation of the package tmp dir. After changing it to 2 seconds the error is gone.
要以编程方式执行
trace(utils:::unpackPkgZip, quote(Sys.sleep(2)), at = which(grepl("Sys.sleep", body(utils:::unpackPkgZip), fixed = TRUE)))
(鸣谢@DavidArenburg)
(credits @DavidArenburg)
这篇关于Windows 7,update.packages问题:“无法移动临时安装"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!