我正在使用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
~ %