我想为rgdal
安装"R version 3.2.3 (2015-12-10)"
。
我下载并安装了
然后在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
没有运气!
答案 0 :(得分:22)
终于解决了它。
以下是我如何做到的! OS X 10.10.5 R 3.2.3 GDAL 1.1
gdal-config
文件
echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile
然后source ~/.bash_profile
gdalinfo --version
,检查您的GDAL是否正常工作。这应该与GDAL 1.11.3, released 2015/09/16
之类的东西一样。 install.packages("rgdal")
有效(如果您已完成步骤1-3)。但是,对我来说情况并非如此。所以,如果你还有麻烦,请继续进行。.tar
文件。 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
我遇到了类似的问题。 This帮助了我。
试试:
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
答案 1 :(得分:16)
快速记录@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'))
再次感谢您的回答!
答案 2 :(得分:5)
我在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)
答案 3 :(得分:1)
我通过我的Mac上的conda安装它(OS X 10.10.5)。安装很简单。如果您是康达新手,请查看此http://conda.pydata.org/docs/r-with-conda.html
conda install gdal
gdalinfo --version
# GDAL 2.1.0, released 2016/04/25
R包安装:
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'))
install.packages('rgeos', 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'))
install.packages('maptools', dependencies=TRUE)