代码之家  ›  专栏  ›  技术社区  ›  Leosar

在ubuntu 16.04上安装rgdal时遇到更多问题

  •  0
  • Leosar  · 技术社区  · 7 年前

    http://www.sarasafavi.com/installing-gdalogr-on-ubuntu.html 在其他的回答中也有这样的解释 trouble in installing rgdal on ubuntu 16.04 意思是来自ppa:ubuntugis。

    然后,当我尝试安装rgdal时,出现以下错误

    > install.packages("rgdal")
    Installing package into ‘/home/leonardo/R/x86_64-pc-linux-gnu-library/3.5’
    (as ‘lib’ is unspecified)
    trying URL 'https://cloud.r-project.org/src/contrib/rgdal_1.3-4.tar.gz'
    Content type 'application/x-gzip' length 1664774 bytes (1.6 MB)
    ==================================================
    downloaded 1.6 MB
    
    * installing *source* package ‘rgdal’ ...
    ** package ‘rgdal’ successfully unpacked and MD5 sums checked
    configure: R_HOME: /usr/lib/R
    configure: CC: gcc -std=gnu99
    configure: CXX: g++
    configure: C++11 support available
    configure: rgdal: 1.3-4
    checking for /usr/bin/svnversion... no
    configure: svn revision: 766
    checking for gdal-config... /home/leonardo/anaconda3/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 2.2.2
    checking GDAL version >= 1.11.4... yes
    checking gdal: linking with --libs only... no
    checking gdal: linking with --libs and --dep-libs... no
    /usr/bin/x86_64-linux-gnu-ld: warning: libproj.so.12, needed by /home/leonardo/anaconda3/lib/libgdal.so, not found (try using -rpath or -rpath-link)
    /usr/bin/x86_64-linux-gnu-ld: warning: libpoppler.so.71, needed by /home/leonardo/anaconda3/lib/libgdal.so, not found (try using -rpath or -rpath-link)
    /usr/bin/x86_64-linux-gnu-ld: warning: libxerces-c-3.2.so, needed by /home/leonardo/anaconda3/lib/libgdal.so,
    
    ...
    
    500 lines more
    
    ...
    
    /home/leonardo/anaconda3/lib/libgeos_c.so: undefined reference to `geos::geom::PrecisionModel::PrecisionModel(double)'
    collect2: error: ld returned 1 exit status
    configure: Install failure: compilation and/or linkage problems.
    configure: error: GDALAllRegister not found in libgdal.
    ERROR: configuration failed for package ‘rgdal’
    * removing ‘/home/leonardo/R/x86_64-pc-linux-gnu-library/3.5/rgdal’
    Warning in install.packages :
      installation of package ‘rgdal’ had non-zero exit status
    

    我之前安装的python anaconda似乎有问题,我使用

    conda remove gdal
    

    1 回复  |  直到 7 年前
        1
  •  0
  •   Leosar    7 年前

    解决这一问题的唯一方法是按照 https://conda.io/docs/user-guide/install/linux.html#uninstalling-anaconda-or-miniconda 对ubuntu 16.04做了一些小的修改后,您必须打开一个终端并删除anaconda安装目录:

    rm -rf ~/anaconda3
    
    rm -rf ~/.condarc ~/.conda ~/.continuum
    

    编辑 ~/.bashrc

    之后安装rgdal

    install.packages("rgdal")
    

    没有问题。