如何解决`sf`安装错误:在标准或给定位置找不到proj_api.h

问题描述

我需要在 CentOS 7 中为 R 安装 sf 软件包。

gdalproj 的 repo 版本低于软件包所需的版本,因此我从源代码安装它们。

即使链接这些库,我也总是遇到相同的错误:

configure: GDAL: 3.2.0
checking proj.h usability... no
checking proj.h presence... no
checking for proj.h... no
checking proj_api.h usability... no
checking proj_api.h presence... no
checking for proj_api.h... no
configure: error: proj_api.h not found in standard or given locations.
ERROR: configuration failed for package ‘sf’

我尝试了来自不同来源(CRAN、GitHub、本地)的不同命令,但总是得到相同的错误。

例如:

install_github("r-spatial/sf",configure.args="--with-gdal-config=/usr/local/gdal-3.2.0/bin/gdal-config --with-proj-lib=/usr/local/proj-7.2.0/lib --with-proj-include=/usr/local/proj-7.2.0/include")

proj_api.h 出现在指定路径:

locate proj_api.h
/usr/local/proj-7.2.0/include/proj_api.h

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)