簡體   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