在ubuntu 16.04上安装rgdal时出现问题

时间:2017-11-06 16:22:42

标签: r ubuntu ubuntu-16.04 rgdal

我一直在尝试在R 3.4.2(RStudio 1.1.383)和ubuntu 16.04上安装rgdal,但它总是以问题结束。

我已经遵循了许多建议,例如使用homebrew手动安装libproj-dev等依赖项或上一次尝试。

我能够安装gdal 1.11.3,但这还不够。

这是我写

时的输出
    install.packages('rgdal', type = "source", configure.args=c('--with-proj-include=/usr/local/include','--with-proj-lib=/usr/local/lib'))

Installing package into ‘/home/tupac/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
essai de l'URL 'https://cran.rstudio.com/src/contrib/rgdal_1.2-15.tar.gz'
Content type 'application/x-gzip' length 1648779 bytes (1.6 MB)
==================================================
downloaded 1.6 MB

* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ correctement décompressé et sommes MD5 vérifiées
configure: CC: gcc -std=gnu99
configure: CXX: g++
configure: rgdal: 1.2-15
checking for /usr/bin/svnversion... no
configure: svn revision: 691
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 1.11.3
checking GDAL version >= 1.6.3... yes
checking gdal: linking with --libs only... yes
checking GDAL: /usr/share/gdal/1.11/pcs.csv readable... yes
configure: -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -I/usr/local/include 
checking proj_api.h presence and usability... no
configure: error: proj_api.h not found in standard or given locations.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/home/tupac/R/x86_64-pc-linux-gnu-library/3.4/rgdal’
Warning in install.packages :
  installation of package ‘rgdal’ had non-zero exit status

找不到错误" proj_api.h"同样post中也找到了解决方案,但给出的解决方案在我的情况下不起作用,而它似乎适用于许多其他用户。

感谢您帮助我解决此问题。

1 个答案:

答案 0 :(得分:4)

我终于找到了解决方案。

我按照post

的回答

奇迹代码是

sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
sudo apt update
sudo apt install gdal-bin python-gdal python3-gdal libgdal1-dev

谢谢你的帮助