在macOS Sierra 10.12.6和R版本3.4.1上安装RGtk2

时间:2017-09-19 02:52:19

标签: r gtk homebrew macos-sierra rattle

我的最终目标是在R中安装拨浪鼓包,为此,我需要安装依赖关系RGtk2。

此问题与Installing RGtk2 on macOS Sierra (Version 10.12.4) and R version 3.4.0类似 但是我安装了gtk。 此问题与R In install.packages("RGtk2") : fatal error: 'gdk/gdkx.h' file not found类似 但这个问题仍然存在,我希望有人能够对这个问题有更多启发。

我遇到的错误如下:

* installing to library ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library’
* installing *source* package ‘RGtk2’ ...
** package ‘RGtk2’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for INTROSPECTION... no
checking for GTK... yes
checking for GTHREAD... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out

...

Rgtk.c:7:10: fatal error: 'gdk/gdkx.h' file not found
#include <gdk/gdkx.h>

我已经看到了强制或忽略gdk / gdkx.h的解决方案,但对我来说这似乎很可疑。

要安装拨浪鼓,我已采取以下步骤。在这个字符串R 3.0 and GTK+ / RGTK2 error之后,我尝试使用GTK_2.24.17-X11.pkg从http://r.research.att.com/#other下载Simon Urbanek的库,但它没有用。

从同样的问题,我也通过复制他们提供的命令从brew.sh安装了自制软件。

brew install gtk+
export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig:$PKG_CONFIG_PATH
R CMD INSTALL /Users/joshualamstein/Downloads/RGtk2_2.20.33.tar

这导致了我现在的结果和我的问题。我的最终目标是在R中安装拨浪鼓包,为此,我需要安装依赖关系RGtk2。任何帮助你将不胜感激。谢谢!

1 个答案:

答案 0 :(得分:2)

zhiyzou发布的解决方案适用于Sierra 10.12.6和R 3.4.2:https://gist.github.com/zhiyzuo/a489ffdcc5da87f28f8589a55aa206dd

然后确保重启Rstudio,或通过XQuartz启动。