在 Centos 上安装 R 'sf' 软件包 -- gdal 共享库错误



如何在CentOS上安装R 'sf'软件包?尝试安装时,由于过期的GDAL软件包,我最初遇到了错误。我更新了GDAL(从消息来源构建:http://trac.osgeo.org/gdal/wiki/wiki/buildingonunix),现在有一个错误:

 checking GDAL: linking with --libs only... yes
 checking GDAL: /usr/local/share/gdal/pcs.csv readable... yes
 checking GDAL: checking whether PROJ.4 is available for linking:... yes
 checking GDAL: checking whether PROJ.4 is available fur running:... 
 ./gdal_proj: error while loading shared libraries: libgdal.so.20: cannot open 
 shared object file: No such file or directory
  no
 configure: error: OGRCoordinateTransformation() does not return a 
coord.trans: 
 PROJ.4 not available?
ERROR: configuration failed for package ‘sf’

我尝试过与libgdal.so.20创建一个符号链接,但这根本不会更改错误。

  1. /usr/local/lib添加到例如/etc/ld.so.conf.d/libgdal-x86_64.conf
  2. 运行ldconfig
  3. 重新启动r
  4. 重试

@dave给出了精确的步骤&请按照以下步骤进行更多解释。

  1. /usr/local/lib添加到例如/etc/ld.so.conf.d/libgdal-x86_64.conf请创建文件 libgdal-x86_64.conf 如果不存在。

#echo "/usr/local/lib" >> /etc/ld.so.conf.d/libgdal-x86_64.conf

  1. 运行ldconfig

#ldconfig

  1. 确保系统上安装了GEOS,GDAL,PROJ

#yum install proj.x86_64 proj-devel.x86_64 proj-epsg.x86_64 proj-nad.x86_64 geos*

再次尝试

  1. 转到R CLI&打 install.packages("sf")

谢谢希望这会有所帮助

对于具有多用户/多计算机环境的任何其他人都需要安装多个版本的各种软件,我将我的问题解决了:

install.packages('sf',configure.args='--with-gdal-config=/sw/gdal/2.2.3-gcc4/bin/gdal-config --with-proj-include=/sw/proj/4.9.3-gcc4/include --with-proj-lib=/sw/proj/4.9.3-gcc4/lib --with-proj-share=/sw/proj/4.9.3-gcc4/share/proj')

显然您可能/必须从我拥有的路径名称中更改路径名。

最新更新