23

我看到了这个问题的一个版本,但仍然没有看到答案。我正在尝试使用 ggplot2,但出现以下错误(今天早上使用 RStudio 版本 0.98.1102 的 R3.0.2 '飞盘航行' 一切正常。

我更新了 R 和 Rstudio,现在得到以下信息:

library(ggplot)
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
           there is no package called ‘stringi’
            Error: package or namespace load failed for ‘ggplot2’

所以很自然地我尝试了:

> install.packages('stringi')

**There is a binary version available but the source version is later:
    binary source needs_compilation
 stringi  0.4-1  0.5-2             FALSE**

 installing the source package ‘stringi’

trying URL 'http://cran.rstudio.com/src/contrib/stringi_0.5-2.tar.gz'
Content type 'application/x-gzip' length 3641292 bytes (3.5 MB)
==================================================
downloaded 3.5 MB

* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
checking for local ICUDT_DIR... icu55/data
checking for R_HOME... /Library/Frameworks/R.framework/Resources
checking for R... /Library/Frameworks/R.framework/Resources/bin/R
checking for R >= 3.1.0... yes
checking for cat... /bin/cat
/Library/Frameworks/R.framework/Resources/bin/config: line 150: make: 

command not found

/Library/Frameworks/R.framework/Resources/bin/config: line 151: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 152: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 153: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 269: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 150: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 151: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 152: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 153: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 269: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 150: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 151: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 152: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 153: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 269: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 150: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 151: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 152: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 153: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 269: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 150: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 151: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 152: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 153: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 269: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 150: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 151: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 152: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 153: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 269: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 150: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 151: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 152: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 153: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 269: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 150: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 151: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 152: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 153: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 269: make: command not found
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/private/var/folders/bq/3jbmwwh553s395pjg1m9h7fr0000gn/T/Rtmpugc1jZ/R.INSTALLc4677f69ffba/stringi':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
ERROR: configuration failed for package ‘stringi’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/stringi’
Warning in install.packages :
  installation of package ‘stringi’ had non-zero exit status

    The downloaded source packages are in
        ‘/private/var/folders/bq/3jbmwwh553s395pjg1m9h7fr0000gn/T/RtmpXvl7fe/downloaded_packages’

关于如何安装“stringi”的任何建议?我对错误输出并不熟悉。我应该尝试回到旧版本的 R 和 Rstudio 吗?最终,我担心这将是现在无法与更新的 R 一起使用的软件包的冰山一角

哦,还有:

 > sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
Running under: OS X 10.7.5 (Lion)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] plyr_1.8.3   tools_3.2.1  gtable_0.1.2 Rcpp_0.11.6  grid_3.2.1  digest_0.6.8 proto_0.3-10
4

6 回答 6

19

我有同样的问题。Marek 在上面的评论中, install.packages 正在寻找源代码而不是二进制文件,因为它更新,对我来说也是正确的。但是由于某种原因,他使用“选项”行的建议对我不起作用。然而,这确实奏效了:

install.packages("stringi",type="mac.binary")

这比尝试通过 Xcode 安装编译器来处理源包要容易得多。

于 2015-06-27T23:24:33.820 回答
5

install.packages.check.source如果源比二进制更新,您是导致 R 尝试从源安装包的选项的受害者。更新包时会发生这种情况(二进制文件在源代码后显示 <72)。这是一个案例stringi(看看你收到的消息:)here is a binary version available but the source version is later

我设置

options(install.packages.check.source = "no")

在我的.Rprofile文件中不要担心install.packages。我需要做的就是等待编译二进制文件。

于 2015-06-26T21:35:25.957 回答
5

我试过install.packages("stringi")了,它导致我R Studio停止识别我安装的软件包。

我通过运行此命令解决了它。希望能帮助到你:

install.packages("stringi", repos="http://cran.rstudio.com/", dependencies=TRUE)
于 2016-01-29T22:02:15.980 回答
3

在 Rstudio 中运行命令时,当弹出一条消息“你想从源安装需要编译的包”时,我点击“否”,它工作了!我最初选择了“是”。但这对我不起作用。然后我在这里阅读了一篇文章,以了解应该选择什么。选择“否”后,它起作用了...

于 2018-05-15T02:48:22.300 回答
1

在 Windows 8 中以管理员身份运行 R 为我解决了这个问题。

于 2015-07-01T14:57:57.583 回答
0

您需要按照此处的说明为 Xcode 安装命令行工具:

https://support.rstudio.com/hc/en-us/articles/200486498-Package-Development-Prerequisites

于 2015-06-26T12:05:56.970 回答