繁体   English   中英

在 Centos 上安装 R 'sf' 包 — gdal 共享库错误

[英]Install R 'sf' package on Centos — gdal shared library error

如何在 CentOS 上安装 R 'sf'软件包? 在尝试安装时,由于 gdal 软件包过时,我最初遇到错误; 我更新了 gdal(从以下源代码构建: http : //trac.osgeo.org/gdal/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')

显然,您可能/将不得不更改我所拥有的路径名。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM