安装 xml2 R 包时的错误信息 [英] Error message when installing xml2 R package

查看:30
本文介绍了安装 xml2 R 包时的错误信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 Windows 机器上更新到 R 4.0.0 后,我无法安装一些软件包,例如 xml2(foreignnnet 也是如此).当我尝试安装时收到此错误消息:

After updating to R 4.0.0 on my Windows machine, I can't install some packages such as xml2 (the same goes for foreign and nnet). When I try to install I get this error message:

* installing *source* package 'foreign' ...
** package 'foreign' successfully unpacked and MD5 sums checked
** using staged installation
** libs

*** arch - i386
"c:/rtools40/mingw32/bin/"gcc  -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG          -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c R_systat.c -o R_systat.o
sh: c:/rtools40/mingw32/bin/gcc: No such file or directory
make: *** [C:/PROGRA~1/R/R-40~1.0/etc/i386/Makeconf:222: R_systat.o] Error 127
ERROR: compilation failed for package 'foreign'
* removing 'C:/R-PKGS/win-library/3.6/foreign'
* restoring previous 'C:/R-PKGS/win-library/3.6/foreign'
Warning in install.packages :
  installation of package ‘foreign’ had non-zero exit status

安装xml2包的主要原因是我想使用tidyverse包,但是当我尝试运行library(tidyverse)我收到这条消息:

The main reason for installing the xml2 package is that I want to use the tidyverse package, but when I try to run library(tidyverse) I get this message:

Error: package or namespace load failed for ‘tidyverse’:
 package ‘xml2’ was installed before R 4.0.0: please re-install it

所以我想我必须能够解决在我尝试安装 xml2 包时出现的问题,因为将来必须更新其他包时可能会发生这种情况.

So I guess that I will have to be able to solve the problem that occurs when I try to install the xml2 package as it may occur in the future when other packages will have to be updated.

亲切的问候,安德烈斯

推荐答案

R 4.0 on Windows 附带一个新的工具集 rtools40,可以单独安装.该工具集包含用于在 Windows 上安装源代码包的编译器和其他编程工具,而编译器通常已在 Linux 系统上可用.该工具集可以从 CRAN 安装,但通常不是必需的, 如果只安装了预编译的二进制包".

R 4.0 on Windows is accompanied with a new tool set rtools40 that can be installed separately. The tool set contains compilers and other programming tools to install source code packages on Windows, while the compilers are usually already available on Linux systems. The tool set can be installed from CRAN, but it is usually not necessary, if only pre-compiled "binary packages" are installed.

如果来自不同 R 版本的软件包默认安装在 Windows 中的同一个文件夹中,即所谓的个人库",有时会出现额外的混乱:

An additional confusion can sometimes occur if packages from different versions of R are installed in the same folder, the so-called "personal library", in Windows by default:

c:\users\<username>\R\win-library

... 或其他用户指定的文件夹.更新到新的 R 版本后,最好清理旧的 win 库.确保文件夹不包含有价值的个人数据.

... or another user-specified folder. After updating to a new R version, it can be a good idea to clean up older win-libraries. Make sure, that the folders do not contain valuable personal data.

这篇关于安装 xml2 R 包时的错误信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆