R 中的错​​误:(包仅以源代码形式提供,可能需要编译 C/C++/Fortran) [英] Error in R: (Package which is only available in source form, and may need compilation of C/C++/Fortran)

查看:26
本文介绍了R 中的错​​误:(包仅以源代码形式提供,可能需要编译 C/C++/Fortran)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 R-Studio 中安装 'yaml' 和 'stringi' 包,但它一直给我这些错误:

I'm trying to install the 'yaml' and 'stringi' packages in R-Studio, and it keeps giving me these errors:

> install.packages("stringi")
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘stringi’
These will not be installed

> install.packages('yaml')
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘yaml’
These will not be installed

我怎样才能正确安装这些?

How can I get these to install properly?

推荐答案

这个错误是由于 R 无法在 CRAN 上找到包的二进制版本,而只能找到 source 版本该软件包和您的 Windows 安装无法编译它.通常这不会发生,但在这种情况下是由 CRAN 的一些镜像(临时)中断引起的.如果你输入:

The error is due to R being unable to find a binary version of the package on CRAN, instead only finding a source version of the package and your Windows installation being unable to compile it. Usually this doesn't occur, but in this case was caused by the (temporary) outage of some of the mirrors at CRAN. If you type:

> getOption('repos')
                                CRAN                            CRANextra 
           "http://cran.rstudio.com" "http://www.stats.ox.ac.uk/pub/RWin" 
attr(,"RStudio")
[1] TRUE

您将看到 R 默认使用 "http://cran.rstudio.com" 来查找要下载的包.如果您看到 cran 镜像网页,您可以在顶部看到 http://cran.rstudio.com" 实际上会将您重定向到世界各地的不同服务器(我假设根据地理位置).

You will see that R uses "http://cran.rstudio.com" by default to look for a package to download. If you see the cran mirrors web page you can see at the top that "http://cran.rstudio.com" actually redirects you to different servers world wide (I assume according to the geo location).

当我遇到上述问题时,我通过手动将 repo 更改为提供的链接中的一个 url 来解决它.如果您收到上述错误,我建议您使用不同的国家(甚至大陆).

When I had the above issue, I solved it by manually changing the repo to one of the urls in the link provided. I suggest you use a different country (or even continent) in case you receive the above error.

如果上面的链接发生变化,我会在下面提供一些网址:

I provide below some of the urls in case the link above changes:

  1. 巴西http://nbcgib.uesc.br/mirrors/cran/
  2. 意大利 http://cran.mirror.garr.it/mirrors/CRAN/
  3. 日本 http://cran.ism.ac.jp/
  4. 南非http://r.adu.org.za/
  5. 美国 https://cran.cnr.Berkeley.edu/

你需要运行install.packages函数如下:

install.packages('<package_name>', repo='http://nbcgib.uesc.br/mirrors/cran/')
#or any other url from the list or link

然后其中一个应该可以从备用镜像安装二进制文件.

One of them should then work to install a binary from an alternative mirror.

这篇关于R 中的错​​误:(包仅以源代码形式提供,可能需要编译 C/C++/Fortran)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆