【问题标题】:RStudio can't install "igraph" - C compiler cannot create executablesRStudio 无法安装“igraph” - C 编译器无法创建可执行文件
【发布时间】:2019-11-13 08:31:11
【问题描述】:

我使用的是 anaconda,所以是 RStudio 1.1.456。

当我尝试时

install.packages("igraph")

我收到这条消息:

trying URL 'https://cran.rstudio.com/src/contrib/igraph_1.2.4.1.tar.gz'
Content type 'application/x-gzip' length 2704004 bytes (2.6 MB)
==================================================
downloaded 2.6 MB

* installing *source* package ‘igraph’ ...
** package ‘igraph’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... x86_64-apple-darwin13.4.0-clang
checking whether the C compiler works... no
configure: error: in `/private/var/folders/x1/zlhhtxm951v95d461h7d09bc0000gn/T/Rtmp0iNakh/R.INSTALL16a5d3eb16782/igraph':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘igraph’
* removing ‘/Users/RobinHorn/anaconda3/envs/Data_Analysis/lib/R/library/igraph’
Warning in install.packages :
  installation of package ‘igraph’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/x1/zlhhtxm951v95d461h7d09bc0000gn/T/RtmpYbzkOw/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

看来我的 C 编译器不工作了。

我已经尝试过的:

安装命令行工具

xcode-select --install

安装缺少的标头:

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /  

这会导致:

installer: Error - the package path specified was invalid: '/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg'.

gcc 似乎安装正确:

~ % gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
~ % 

【问题讨论】:

    标签: r anaconda rstudio igraph


    【解决方案1】:

    我遇到了你的帖子,因为我遇到了同样的问题。我的回答取决于一个问题:你真的需要通过 Anaconda 访问 RStudio 吗?如果您的回答是“否”,那么解决方案很简单:

    我从 rstudio.com 下载了 RStudio,并直接安装在我的 Mac 上;版本恰好是 1.2.5033。现在当我安装时

    install.packages("igraph")
    

    一切正常。我已经测试了几个没有问题的功能(但不要忘记加载包)。

    请注意,当我通过 Anaconda 返回 RStudio 时,它仍然无法正常工作。显然,Anaconda 保留了自己的安装树副本,但不能很好地与某些软件包配合使用...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-16
      • 1970-01-01
      • 1970-01-01
      • 2021-12-06
      • 2021-02-04
      • 2013-06-17
      • 1970-01-01
      相关资源
      最近更新 更多