install.packages 'rgdal' 中的错误:找不到 gdal-config - 配置参数错误

error in install.packages 'rgdal': gdal-config not found - configure argument error

我正在尝试在 rstudio 中安装 rgdal 包。我正在使用 centos8。我已经安装了:

sudo yum install gdal gdal-devel
sudo yum install geos geos-devel 

我也尝试过使用以下方式安装:

install.packages('rgdal', type = "source", configure.args=c(
    '--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config',
    '--with-proj-include=/Library/Frameworks/PROJ.framework/Headers',
    '--with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'))

我的错误信息:

configure: error: gdal-config not found - configure argument error.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/home/motipai/R/x86_64-redhat-linux-gnu-library/4.0/rgdal’
Warning in install.packages :
  installation of package ‘rgdal’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmp5jeQl8/downloaded_packages’

首先在终端中安装:

sudo yum install gdal.x86_64 gdal-devel.x86_64 gdal-libs.x86_64
sudo yum install proj.x86_64 proj-devel.x86_64

然后在 r 控制台中:

install.packages("rgdal")

解决问题。