由于在服务器上新装 CentOS7 系统,缺少一些 lib,因此在安装一些 R 包的时候 出现一系列报错。安装 R 包时最重要的报错信息在第一条,缺啥包会提示地很清晰。
比如本人在安装 tidyverse
的时候
install.packages("tidyverse", INSTALL_opts = c('--no-lock'))
出现以下报错:
缺少 libcurl
Package libcurl was not found in the pkg-config search path. Perhaps
you should add the directory containing `libcurl.pc’ to the
PKG_CONFIG_PATH environment variable No package ‘libcurl’ found
这说明本机没有 curl
和相关开发工具,因此用以下命令进行安装
在官网( https://curl.haxx.se/download.html )找到最新 curl 的版本和下载地址
wget -c https://curl.haxx.se/download/curl-7.65.0.tar.gz
tar -zxf curl-7.65.0.tar.gz
cd curl-7.65.0
./configure
make
sudo make install
sudo yum install libcurl-devel
缺少 openssl
ERROR: configuration failed for package ‘openssl’
此报错说明缺少 openssl
依赖,使用以下命令解决
yum install openssl
yum install openssl-devel
缺少 libxml-2.0
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc’ to the
PKG_CONFIG_PATH environment variable No package ‘libxml-2.0’ found
此报错说明缺少 libxml2
依赖,使用以下命令解决
yum install libxml2
yum install libxml2-devel