gpt4 book ai didi

r - 协助在 Mac 上安装 'rgdal' 包

转载 作者:行者123 更新时间:2023-12-04 17:29:26 24 4
gpt4 key购买 nike

如何在 MacOS Catalina 上安装“rgdal”包?

运行以下代码:

 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'))

获取以下错误信息:
trying URL 'https://cran.rstudio.com/src/contrib/rgdal_1.4-8.tar.gz'
Content type 'application/x-gzip' length 1698902 bytes (1.6 MB)
==================================================
downloaded 1.6 MB
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: R_HOME: /Library/Frameworks/R.framework/Resources
xcrun: error: invalid active developer path /Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
configure: C++11 support not available
configure: rgdal: 1.4-7
checking for /usr/bin/svnversion... yes
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
configure: svn revision: 845
configure: gdal-config set to /Library/Frameworks/GDAL.framework/Programs/gdal-config
checking gdal-config exists... no
configure: error: gdal-config not found - configure argument error.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rgdal’
Warning in install.packages :
installation of package ‘rgdal’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/vz/0nmhj0qj27s_y3zjxjx6w3g40000gn/T/RtmpW2iTzA/downloaded_packages’

最佳答案

根据 Ish 的评论安装和使用 Homebrew。它将使此安装工作,您将能够避免在 MacOSX 上使用 R 包的其他常见安装错误。
在 Homebrew 安装后的终端中运行 'brew install gdal' 然后在 R 中使用安装包 'install.packages("rgdal", type="source")'

关于r - 协助在 Mac 上安装 'rgdal' 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61108783/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com