问题描述
我想为"R version 3.2.3 (2015-12-10)"
安装rgdal
.我下载并安装了
I want to install rgdal
for "R version 3.2.3 (2015-12-10)"
.I downloaded and installed
- GDAL 1.11完成
- PROJ框架v4.9.2-2
- GEOS框架v3.5.0-1
来自 KingngChaos
然后在RStudio中,键入install.packages("rgdal")
,这给了我:
Then in RStudio I typed install.packages("rgdal")
which gave me this:
> ....
>
> 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
没有运气!
推荐答案
最终解决了它.
这就是我的方法!OS X 10.10.5R 3.2.3GDAL 1.1
Here is how I've done it!OS X 10.10.5R 3.2.3GDAL 1.1
- 从此处下载并安装GDAL完整框架
- 通过在shell中键入此文件,告诉OS X在哪里找到
gdal-config
文件echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile
然后source ~/.bash_profile
- 通过输入bash
gdalinfo --version
来检查GDAL是否工作正常.那应该返回类似GDAL 1.11.3, released 2015/09/16
的东西. - 对于大多数人来说,启动R并键入
install.packages("rgdal")
可以正常工作(如果您已完成步骤1-3).但是,对我而言并非如此.因此,如果仍然遇到问题,请继续执行5. - 转到 GDAL 网站并下载
.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’
- 因此,您再次需要告诉在哪里可以找到那个.试试:
- Download and install the GDAL Complete Framework from here
- Tell your OS X where to find the
gdal-config
file by typing this in you shellecho 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile
and thensource ~/.bash_profile
- Check if your GDAL is working fine by typing in the bash
gdalinfo --version
. That should come back with something likeGDAL 1.11.3, released 2015/09/16
. - For most people, starting R and typing
install.packages("rgdal")
works (if you've done step 1-3). However, that was not the case for me. So, proceed with 5 if you're still having troubles. - Go to the GDAL website and download the
.tar
file. - In the shell, try this:
sudo R CMD INSTALL –configure-args=’–with-proj-include=/usr/local/lib’ rgdal_1.1-1.tar
. That still gave me an error:configure: error: proj_api.h not found in standard or given locations.ERROR: configuration failed for package ‘rgdal’
- So, you again need to tell where to find that one. Try:
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
并在R控制台中键入library(rgdal)
.
That should work. Try by starting R
and type library(rgdal)
in the R console.
注意:在rgoes
中,我遇到了类似的问题. 这帮助了我.试试:
Note: With rgoes
I experienced similar problems. This helped me.Try:
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
For pointing to the config
file. It's here /Library/Frameworks/GEOS.framework/unix/bin/geos-config
这篇关于无法安装rgdal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!