R 3.5.0安装data.table失败,RTools 3.5仍显示不兼容求助
Hey, I’ve dealt with this exact weird quirk before—you actually have the correct RTools version (R 3.5.x pairs with RTools 3.5), that error message is just a small bug in the find_rtools() function’s detection logic. Here are three proven fixes to get you up and running with data.table:
1. Manually Point R to Your RTools Installation
Tell R exactly where your RTools lives by running these commands in your R console:
# Update PATH to include RTools bin directory Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep = ";")) # Set the binary prefix for mingw Sys.setenv(BINPREF = "C:/Rtools/mingw_64/bin/")
Note: If you installed RTools to a different drive or folder (like D:\Rtools), adjust the paths to match your actual installation location. After running these, recheck with find_rtools(T)—the warning should disappear, and you can install data.table normally.
2. Add RTools to Your System’s PATH Environment Variable
Sometimes R can’t find RTools because the system PATH doesn’t include its directories. Fix this manually:
- Right-click "This PC" → Properties → Advanced System Settings → Environment Variables
- Under "System Variables", find the
PATHvariable, click "Edit" - Add two new entries:
[Your RTools Folder]/binand[Your RTools Folder]/mingw_64/bin(e.g.,C:\Rtools\binandC:\Rtools\mingw_64\bin) - Restart R/RStudio, then run
find_rtools(T)to verify
3. Bypass find_rtools() and Install data.table Directly
The error from find_rtools() doesn’t always mean installation will fail. Try installing data.table from source directly:
install.packages("data.table", type = "source")
If your RTools paths are set up correctly under the hood, this command will use RTools to compile and install the package, ignoring the misleading warning.
Quick sanity check: You don’t need to download a different RTools version—R 3.5.0 does require RTools 3.5. The issue is purely about R detecting it properly, not a version mismatch.
内容的提问来源于stack exchange,提问作者Omry Atia

