谢谢大家的帮忙,问题解决了,原来真得是需要在 R 里面单独设置代理。
这一番折腾的源头是我想用 xfun 里面的 read_all 函数,但是平时没撒事不更新 R 包,xfun 还是0.26版本,于是乎,一更新才发现本帖一楼的问题。现在我随便下了几个 R 包,都能正常下载安装。但是万万没想到,事情的源头,更新 xfun 居然还是报错了,哈哈哈。
> install.packages("xfun")
有二进制版本的,但源代码版本是后来的:
binary source needs_compilation
xfun 0.36 0.37 TRUE
安装源码包‘xfun’
trying URL 'https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/xfun_0.37.tar.gz'
Content type 'application/octet-stream' length 130063 bytes (127 KB)
downloaded 127 KB
* installing *source* package 'xfun' ...
** package 'xfun' successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"D:/R/R-42~1.0/include" -DNDEBUG -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c base64.c -o base64.o
sh: gcc: command not found
make: *** [D:/R/R-42~1.0/etc/x64/Makeconf:252: base64.o] Error 127
ERROR: compilation failed for package 'xfun'
* removing 'D:/R/R-4.2.0/library/xfun'
* restoring previous 'D:/R/R-4.2.0/library/xfun'
Warning in install.packages :
安装程序包‘xfun’时退出狀態的值不是0
我手动下载了 xfun_0.37.zip,手动安装也报错。哈哈哈,怎么这么搞笑。但是换成xfun_0.36.zip,就正常了。
> install.packages("D:/R/xfun_0.37.zip", repos = NULL, type = "win.binary")
程序包‘xfun’打开成功,MD5和检查也通过
Error in install.packages : package ‘xfun’ not installed because it is not built for UCRT
> session_info()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044), RStudio 2022.12.0.353
Locale:
LC_COLLATE=Chinese (Simplified)_China.utf8 LC_CTYPE=Chinese (Simplified)_China.utf8 LC_MONETARY=Chinese (Simplified)_China.utf8
LC_NUMERIC=C LC_TIME=Chinese (Simplified)_China.utf8
Package version:
compiler_4.2.0 graphics_4.2.0 grDevices_4.2.0 stats_4.2.0 tools_4.2.0 utils_4.2.0 xfun_0.36