一、错误描述
install.packages("SetMethods")#安装所需要的包
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
还安装相依关系‘fs’, ‘rappdirs’, ‘base64enc’, ‘digest’, ‘jquerylib’, ‘memoise’, ‘sass’, ‘colorspace’, ‘utf8’, ‘httpuv’, ‘mime’, ‘jsonlite’, ‘xtable’, ‘fontawesome’, ‘htmltools’, ‘R6’, ‘sourcetools’, ‘later’, ‘promises’, ‘crayon’, ‘fastmap’, ‘commonmark’, ‘bslib’, ‘cachem’, ‘ellipsis’, ‘farver’, ‘labeling’, ‘munsell’, ‘RColorBrewer’, ‘viridisLite’, ‘fansi’, ‘magrittr’, ‘pillar’, ‘pkgconfig’, ‘zoo’, ‘shiny’, ‘declared’, ‘venn’, ‘lpSolve’, ‘cli’, ‘glue’, ‘gtable’, ‘isoband’, ‘lifecycle’, ‘rlang’, ‘scales’, ‘tibble’, ‘vctrs’, ‘withr’, ‘Rcpp’, ‘flexmix’, ‘Formula’, ‘lmtest’, ‘modeltools’, ‘sandwich’, ‘QCA’, ‘admisc’, ‘ggplot2’, ‘ggrepel’, ‘stargazer’, ‘scatterplot3d’, ‘fmsb’, ‘betareg’
二、解决方案——下载安装对应版本的Rtools
(一)方案描述
Rtools安装步骤:
1. 下载Rtools:- 访问下载地址(链接待添加),选择与您的R版本对应的Rtools版本,如R3.6.2选择Rtools35,然后开始下载。
2. 安装Rtools:
- 双击下载好的Rtools安装包,开始安装。
- 点击“OK”。
- 点击“next”。
- 选择安装目录,点击“next”。
- 保持默认选择,点击“next”。
- 勾选“添加Rtools到环境变量中”,点击“next”。
- 点击“next”。
- 点击“install”开始安装。
- 安装完成后点击“finish”。
(二)具体步骤
1、下载对应版本的Rtools
下载地址:添加链接描述
因为我是用的是R3.6.2应该下载Rtools35,所以点击“this page”
根据自己R的版本选择Rtools的版本,我选择Rtools35,然后开始下载。
2、安装对应版本的Rtools
1)双击下载好的Rtools安装包,开始安装。

2)点击OK

3)点击next

4)选择安装目录,点击next

5)可保持默认选择,点击next
6)勾选添加 rtools 到环境变量中,点击next

7)点击next

8点击install开始安装
点击finish就安装完成了。
然后再次打开R输入命令:
就可以正常执行!devtools::install_github('IRkernel/IRkernel')