如何在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
创建一个符号链接,但这根本不会更改错误。
- 将
/usr/local/lib
添加到例如/etc/ld.so.conf.d/libgdal-x86_64.conf
- 运行ldconfig
- 重新启动r
- 重试
@dave给出了精确的步骤&请按照以下步骤进行更多解释。
- 将
/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
- 运行ldconfig
#ldconfig
- 确保系统上安装了
GEOS,GDAL,PROJ
。
#yum install proj.x86_64 proj-devel.x86_64 proj-epsg.x86_64 proj-nad.x86_64 geos*
再次尝试
- 转到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')
显然您可能/必须从我拥有的路径名称中更改路径名。