无法在R中安装任何软件包

时间:2020-02-01 21:20:11

标签: r package

我正在使用Windows,并且无法在R中安装任何软件包。我在R 3.53和3.62中进行了尝试。两者都给出错误。 我最终得到以下类型的错误:

Error in install.packages : cannot open file 'C:/Users/Arti Agarwal/Documents/R/win-library/3.5/file3a2065f64427/BH/include/boost/geometry/util/readme.txt': Permission denied

我还会在以下两种情况之间收到此类错误:

  There is a binary version available but the source version is later:
     binary source needs_compilation
yaml  2.2.0  2.2.1              TRUE

我不知道如何进一步解决此问题。有什么建议吗?

2 个答案:

答案 0 :(得分:1)

我想我已经解决了。将答案发布给其他有相同问题的人。

1)我通过以R身份运行R解决了文件权限错误。 2)这些软件包不适用于R 3.6.2或R 3.5.3,但奇怪的是它们与R 3.6.1兼容 它警告该软件包是用R 3.6.2生成的,但在安装时不起作用。因此造成混乱。

感谢您的所有帮助。

答案 1 :(得分:-3)

为Windows安装conda

# if you have 64 bit computer:
https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe
# if 32 bit computer:
https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86.exe

运行exe。 为您的R创建一个新环境:

# create new virtual environment for R with name 'newR'
conda create --name newR
# enter this created environment
conda activate newR # or: source activate newR
# install there now newest R
conda install -c conda-forge r-base
# you can also install rstudio
conda install -c conda-forge rstudio
# and also more difficult to install R packages
# search for them by googling: 'conda install <packagename>'
# mostly in anaconda site you see command for install.


# next time you want to start R do:

# enter environment
conda activate newR # if that doesn't work: source activate newR
# start R
R

了解仅需11分钟即可完成的基本conda命令: https://www.youtube.com/watch?v=YJC6ldI3hWk

如果您想成为一名认真的开发人员/程序员,无论如何迟早都要学习conda。