CentOS 7 安裝 R 包報錯,解決缺少 libcurl openssl libxml2

由於在服務器上新裝 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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章