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

查看:200
本文介绍了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

如何使它们正确安装?

推荐答案

该错误是由于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"查找要下载的软件包.如果您看到颅骨镜网页,您会在顶部看到"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).

遇到上述问题时,我通过将存储库手动更改为提供的链接中的其中一个网址来解决了该问题.如果您收到上述错误,建议您使用其他国家(或地区).

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/
  1. Brazil http://nbcgib.uesc.br/mirrors/cran/
  2. Italy http://cran.mirror.garr.it/mirrors/CRAN/
  3. Japan http://cran.ism.ac.jp/
  4. South Africa http://r.adu.org.za/
  5. USA https://cran.cnr.Berkeley.edu/

您需要按以下方式运行函数install.packages:

You need to run the function install.packages as follows:

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天全站免登陆