当前位置:  开发笔记 > 编程语言 > 正文

无法安装rgdal

如何解决《无法安装rgdal》经验,为你挑选了3个好方法。

我想安装rgdal"R version 3.2.3 (2015-12-10)".我下载并安装了

GDAL 1.11完成

PROJ框架v4.9.2-2

GEOS框架v3.5.0-1

来自KyngChaos

然后在RStudio我打字install.packages("rgdal")给了我这个:

> .... 
> 
> configure: CC: clang configure: CXX: clang++ configure: rgdal:
> 1.1-1 checking for /usr/bin/svnversion... yes configure: svn revision: 
> 572 checking for gdal-config... 
> no no configure: error: gdal-config
> not found or not executable. ERROR: configuration failed for package
> ‘rgdal’
> * removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgdal’
> Warning in install.packages :   installation of package ‘rgdal’ had
> non-zero exit status

> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] de_AT.UTF-8/de_AT.UTF-8/de_AT.UTF-8/C/de_AT.UTF-8/de_AT.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_3.2.3

我也在终端试过了

R CMD INSTALL rgdal_1.1-1.tar --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config
 --with-proj-include=/Library/Frameworks/PROJ.framework/Headers
 --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'

sudo R CMD INSTALL –configure-args=’–with-proj-include=/usr/local/lib’ rgdal_1.1-1.tar

没运气!



1> Stophface..:

终于解决了.

我是怎么做到的!OS X 10.10.5 R 3.2.3 GDAL 1.1

    从这里下载并安装GDAL Complete Framework

    告诉你的OS X在哪里可以找到gdal-config通过键入这在你shell文件 echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile,然后source ~/.bash_profile

    通过键入bash来检查您的GDAL是否正常工作gdalinfo --version.这应该会回来GDAL 1.11.3, released 2015/09/16.

    对于大多数人来说,开始R和打字install.packages("rgdal")工作(如果您已完成步骤1-3).但是,对我来说情况并非如此.所以,如果你仍然遇到麻烦,请继续5.

    转到GDAL网站下载.tar文件.

    在shell中,试试这个:sudo R CMD INSTALL –configure-args=’–with-proj-include=/usr/local/lib’ rgdal_1.1-1.tar.这仍然给了我一个错误:configure: error: proj_api.h not found in standard or given locations. ERROR: configuration failed for package ‘rgdal’

    所以,你再次需要告诉在哪里找到那个.尝试: R CMD INSTALL rgdal_1.1-1.tar --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config --with-proj-include=/Library/Frameworks/PROJ.framework/Headers --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'

这应该工作.尝试启动R并输入library(rgdal).

注意:rgoes我遇到了类似的问题.这对我有帮助.尝试:

R CMD INSTALL rgeos_0.3-15.tar --configure-args='--with-geos-config=/Library/Frameworks/GEOS.framework/unix/bin/geos-config
--with-proj-include=/Library/Frameworks/PROJ.framework/Headers
--with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'

用于指向config文件.它在这里/Library/Frameworks/GEOS.framework/unix/bin/geos-config


谢谢你.无法让它工作.最终在一行中使用家庭酿造安装了gdal,并且能够安装rgdal没有问题.这在OsX 10.11.3 R3.2.3上

2> Fran Villami..:

快速记录@Stophface以前的回答,可能对某些人有用:

我做了上面列出的所有步骤,但终端中的rgdal安装仍然给了我错误configure: error: proj_api.h not found in standard or given locations.然而(并且不知道具体原因),我设法使用几乎相同的规格从R.app安装它:

> install.packages('rgdal', type = "source", configure.args=c(
     '--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config',
     '--with-proj-include=/Library/Frameworks/PROJ.framework/Headers',
     '--with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'))

再次感谢您的回答!



3> SymbolixAU..:

我在macOS Sierra(10.12)上运行R 3.4.0时遇到了同样的错误.所以我用自制软件安装gdal,然后rgdal按照平常安装在R中

在终端

brew update
brew install gdal

在R

install.packages("rgdal")

devtools::session_info()
Session info ----------------------------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.0 (2017-04-21)
 system   x86_64, darwin15.6.0        
 ui       RStudio (1.0.143)           
 language (EN)                        
 collate  en_AU.UTF-8                 
 tz       Australia/Melbourne         
 date     2017-04-24                  

Packages --------------------------------------------------------------------------------------------------------------------------------------------------
 package  * version date       source        
 devtools   1.12.0  2016-12-05 CRAN (R 3.4.0)
 digest     0.6.12  2017-01-27 CRAN (R 3.4.0)
 lattice    0.20-35 2017-03-25 CRAN (R 3.4.0)
 memoise    1.1.0   2017-04-21 CRAN (R 3.4.0)
 rgdal    * 1.2-6   2017-04-06 CRAN (R 3.4.0)
 sp       * 1.2-4   2016-12-22 CRAN (R 3.4.0)
 withr      1.0.2   2016-06-20 CRAN (R 3.4.0)

推荐阅读
女女的家_747
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有