【问题标题】:Install packages does not work: Permission denied安装包不起作用:权限被拒绝
【发布时间】:2018-05-24 11:23:18
【问题描述】:

我正在努力安装“psych”包。

我开始使用命令install.packages("psych")。下载开始,结果如下:

Installing package into ‘C:/Users/Username/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependency ‘mnormt’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/mnormt_1.5-5.zip'
Content type 'application/zip' length 373388 bytes (364 KB)
downloaded 364 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/psych_1.8.4.zip'
Content type 'application/zip' length 5741178 bytes (5.5 MB)
downloaded 5.5 MB

Error in install.packages : cannot open file 'C:/Users/Username/Documents/R/win-library/3.5/file41147bc27f90/mnormt/CITATION': Permission denied

之后我搜索了结果。我禁用了我的防火墙。我还以管理员权限启动了 RStudio。一个建议是在 R(不是 R Studio)中安装包

在那里我尝试再次安装它。结果如下:

Installing package into ‘C:/Users/Username/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
also installing the dependency ‘mnormt’

trying URL 'https://cran.uni-muenster.de/bin/windows/contrib/3.5/mnormt_1.5-5.zip'
Content type 'application/zip' length 373388 bytes (364 KB)
downloaded 364 KB

trying URL 'https://cran.uni-muenster.de/bin/windows/contrib/3.5/psych_1.8.4.zip'
Content type 'application/zip' length 5741178 bytes (5.5 MB)
downloaded 5.5 MB

Error in unzip(zipname, exdir = dest) : 
  cannot open file 'C:/Users/Username/Documents/R/win-library/3.5/file40fc713ca07/mnormt/CITATION': Permission denied

您还有其他解决方法的想法吗?解压程序有问题吗?

【问题讨论】:

    标签: r install.packages psych


    【解决方案1】:

    你可以.libPaths()吗?

    也许.libPaths() 没有映射正确的位置(如果您不是管理员)

    试试.libPaths(.libPaths()[2]),然后再试试install.packages("psych")

    【讨论】:

    • 感谢您的回答。我在 RStudio 中做了推荐。输出为:[1] "C:/Users/Username/Documents/R/win-library/3.5" [2] "C:/Program Files/R/R-3.5.0/library
    • 尝试 .libPaths(.libPaths()[2]) 然后再次尝试 install.packages()
    最近更新 更多