簡體   English   中英

在macOS Sierra(版本10.12.4)和R版本3.4.0上安裝RGtk2

[英]Installing RGtk2 on macOS Sierra (Version 10.12.4) and R version 3.4.0

當我嘗試安裝包RGtk2時,我收到以下錯誤:

 > install.packages("RGtk2") Package which is only available in source form, and may need compilation of C/C++/Fortran: 'RGtk2' Do you want to attempt to install these from sources? y/n: y installing the source package 'RGtk2' trying URL 'https://cran.rstudio.com/src/contrib/RGtk2_2.20.33.tar.gz' Content type 'application/x-gzip' length 2792938 bytes (2.7 MB) ================================================== downloaded 2.7 MB * 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... no configure: error: GTK version 2.8.0 required ERROR: configuration failed for package 'RGtk2' * removing '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2' Warning in install.packages : installation of package 'RGtk2' had non-zero exit status The downloaded source packages are in '/private/var/folders/m4/l02774c51vx71qt6_wdq59lw0000gn/T/Rtmpa7sxIS/downloaded_packages' > 

我正在運行macOS Sierra(版本10.12.4)和R版本3.4.0。

我假設你已經安裝了R和RStudio。 如果沒有,請安裝它。 然后執行以下操作。

1)安裝XQuartz

2)安裝GTK 2.24.17-X11

3)下載cairoDeviceRGtk2

4)從終端運行R CMD INSTALL ~/Downloads/cairoDevice_2.24.tar.gz

5)安裝Homebrew for Mac。

6)從終端類型中輸入以下命令: brew uninstall cairo --ignore-dependencies brew install --with-x11 cairo

7)在終端輸入brew edit gtk+並滾動到def install部分並用quartz編輯引用(按i編輯並保存並退出,按escape鍵並輸入冒號(shift +半冒號鍵)。然后鍵入wq。)

"--with-gdktarget=x11", "--enable-x11-backend"

8)然后在同一終端窗口中鍵入brew install --build-from-source --verbose gtk+

9)然后輸入export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib/pkgconfig/gtk+-2.0.pc:/opt/X11/lib/pkgconfig

10)從同一終端窗口輸入R CMD INSTALL ~/Downloads/RGtk2_2.20.33.tar.gz

希望它對你有用。

您可能沒有在系統中安裝GTK(在R之外)。 您可以在../libs/目錄中嘗試從GTK包安裝:

http://r.research.att.com/libs/ 

可能首先需要XQuartz,適用於macOS版本的Xcode和正確的命令行工具。 bash-install的下載和安裝代碼位於/ libs / page的底部。

當我試圖安裝RGtk2時,這就出現了...我檢查了which gcc ,它顯示了ac編譯器。 為什么說C編譯器不工作?

$ R CMD INSTALL ~/Downloads/RGtk2_2.20.33.tar.gz
* 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... no
configure: error: in `/private/var/folders/xh/kw0cr4xj52zd9pd8t46d6xwh0000gn/T/RtmpnYEC6D/R.INSTALL13a7b3357df80/RGtk2':
configure: error: C compiler cannot create executables
See `config.log' for more details.
ERROR: configuration failed for package ‘RGtk2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2’

按照本網站上的說明可能會有所幫助: https//gist.github.com/sebkopf/9405675

請務必在帖子后閱讀其他對話以進行有用的修改。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM