1. > install.packages("rattle")
  2. Error in install.packages : Updating loaded packages
  3. > install.packages("rattle")
  4. Installing package into ‘/Users/lin/Library/R/4.0/library
  5. (as lib is unspecified)
  6. 试开URLhttps://mirrors.bfsu.edu.cn/CRAN/bin/macosx/contrib/4.0/rattle_5.4.0.tgz'
  7. Content type 'application/octet-stream' length 5476592 bytes (5.2 MB)
  8. ==================================================
  9. downloaded 5.2 MB
  10. The downloaded binary packages are in
  11. /var/folders/2k/0p7yrn9525x_np4x86sstrvh0000gp/T//RtmpB1r7Ky/downloaded_packages
  12. > library(rattle) #没有报错 但是
  13. > rattle()
  14. Error in .C("R_gtkInit", length(args), x = args, success = logical(1), :
  15. 程序包"RGtk2""R_gtkInit"不适用于.C()
  16. #报错了,那么就安装包"RGtk2"
  17. > install.packages('RGtk2')
  18. Error in install.packages : Updating loaded packages
  19. Restarting R session...
  20. > install.packages("RGtk2")
  21. Installing package into ‘/Users/lin/Library/R/4.0/library
  22. (as lib is unspecified)
  23. 试开URLhttps://mirrors.bfsu.edu.cn/CRAN/bin/macosx/contrib/4.0/RGtk2_2.20.36.tgz'
  24. Content type 'application/octet-stream' length 20498711 bytes (19.5 MB)
  25. ==================================================
  26. downloaded 19.5 MB
  27. The downloaded binary packages are in
  28. /var/folders/2k/0p7yrn9525x_np4x86sstrvh0000gp/T//RtmptoTKzU/downloaded_packages
  29. > library(RGtk2)
  30. Error in dyn.load(file, DLLpath = DLLpath, ...) :
  31. 无法载入共享目标对象‘/Users/lin/Library/R/4.0/library/RGtk2/libs/RGtk2.so’::
  32. dlopen(/Users/lin/Library/R/4.0/library/RGtk2/libs/RGtk2.so, 6): Library not loaded: /Library/Frameworks/GTK+.framework/Versions/2.24.X11/Resources/lib/libgtk-x11-2.0.0.dylib
  33. Referenced from: /Users/lin/Library/R/4.0/library/RGtk2/libs/RGtk2.so
  34. Reason: image not found
  35. #同时出现图1,选第一个 然后安装出现下面的代码
  36. Learn more about GTK+ at http://www.gtk.org
  37. If the package still does not load, please ensure that GTK+ is installed and that it is on your PATH environment variable
  38. IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN
  39. Warning message:
  40. Failed to load RGtk2 dynamic library, attempting to install it.

图1## 安装R的机器学习GUI工具rattle包的血泪史 - 图4

安装时提示gtk有问题,后来永和推荐这个 :R for macOS Developers 下载了最新的 GTK_2.24.17-X11.pkg (ca. 41MB),直接官网下载了安装包

  1. > install.packages("~/Downloads/GTK_2.24.17-X11.pkg")
  2. Installing package into ‘/Users/lin/Library/R/4.0/library
  3. (as lib is unspecified)
  4. Warning in install.packages :
  5. package ‘~/Downloads/GTK_2.24.17-X11.pkg is not available for this version of R
  6. A version of this package for your version of R might be available elsewhere,
  7. see the ideas at
  8. https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

本地安装方法 :## 安装R的机器学习GUI工具rattle包的血泪史 - 图5

还是不行:## 安装R的机器学习GUI工具rattle包的血泪史 - 图6

那就代码直接安装

  1. > install.packages("~/Downloads/GTK_2.24.17-X11.pkg")
  2. Installing package into ‘/Users/lin/Library/R/4.0/library
  3. (as lib is unspecified)
  4. Warning in install.packages :
  5. package ‘~/Downloads/GTK_2.24.17-X11.pkg is not available for this version of R
  6. A version of this package for your version of R might be available elsewhere,
  7. see the ideas at
  8. https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

还是不行,结果提示版本不合适,over

结论

mac不可以安装,windows才行 真是两行泪,但是window系统的同道们可以参考这篇文章安装R的机器学习GUI工具rattle包 - 知乎