我一直在尝试安装ncdf R软件包。我已经搜索了答案并尝试解决问题,但看起来我现在是时候在这里寻求帮助了。
我从此页面下载了ncdf_1.6.5.tar.gz(" https://cran.r-project.org/src/contrib/Archive/ncdf/),将其保存在下载文件夹中。
由于它没有NAMESPACE文件,我解压缩文件并执行以下操作
cd Downloads
cd ncdf
echo 'exportPattern( "." )' > NAMESPACE
cd ..
tar -zcf ncdf.tar.gz ncdf
然后我尝试通过此命令安装包
R CMD INSTALL -l /Users/xyc/Downloads/ncdf.tar.gz
它给了我这个
ARGUMENT 'CDM' __ignor'e__
ARGUMENT 'INSTALL' __ignor'e__
AVIS : option inconnue '-l'
ARGUMENT 'ncdf.tar.gz' __ignor'e__
R version 3.4.2 (2017-09-28) -- "Short Summer"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)
R est un logiciel libre livré sans AUCUNE GARANTIE.
Vous pouvez le redistribuer sous certaines conditions.
Tapez 'license()' ou 'licence()' pour plus de détails.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Tapez 'demo()' pour des démonstrations, 'help()' pour l'aide
en ligne ou 'help.start()' pour obtenir l'aide au format HTML.
Tapez 'q()' pour quitter R.
显然,这没有安装包。
我试图通过
安装在RStudio中install.packages("ncdf.tar.gz", lib = "/Users/xyc/Downloads", repos = NULL)
它告诉我
* installing *source* package ‘ncdf’ ...
checking for nc-config... /opt/local/bin/nc-config
configure: creating ./config.status
config.status: creating src/Makevars
** libs
make: error: unable to find utility "make", not a developer tool or in PATH
ERROR: compilation failed for package ‘ncdf’
* removing ‘/Users/xyc/Downloads/ncdf’
* restoring previous ‘/Users/xyc/Downloads/ncdf’
Warning in install.packages :
installation of package ‘ncdf.tar.gz’ had non-zero exit status
有人可以帮助我吗?非常感谢你。
更新 感谢您的所有投入。我下载了Xcode 9和更低版本的ncdf并做了这个
$ sudo xcode-select --switch /Users/xyc/Downloads/Xcode.app
$R CMD INSTALL ncdf_1.6.3.tar.gz
它给了我96个警告和11个错误。编译再次失败。
* installing to library ‘/Users/hhsieh/Library/R/3.4/library’
* installing *source* package ‘ncdf’ ...
checking for nc-config... /opt/local/bin/nc-config
configure: creating ./config.status
config.status: creating src/Makevars
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -
I/opt/local/include -I/usr/local/include -fPIC -Wall -g -O2 -c
._ncdf.c -o ._ncdf.o
._ncdf.c:1:1: warning: null character ignored [-Wnull-character]
<U+0000><U+0005><U+0016><U+0007><U+0000><U+0002><U+0000><U+0000>Mac OS
X <U+0000><U+0002><U+0000><U+0000>...
^
._ncdf.c:1:2: error: expected identifier or '('
<U+0000><U+0005><U+0016><U+0007><U+0000><U+0002><U+0000><U+0000>Mac OS
X <U+0000><U+0002><U+0000><U+0000>...
^
._ncdf.c:1:5: warning: null character ignored [-Wnull-character]
<U+0000><U+0005><U+0016><U+0007><U+0000><U+0002><U+0000><U+0000>Mac OS
X <U+0000><U+0002><U+0000><U+0000>...
^
._ncdf.c:1:7: warning: null character ignored [-Wnull-character]
<U+0000><U+0005><U+0016><U+0007><U+0000><U+0002><U+0000><U+0000>Mac OS
X <U+0000><U+0002><U+0000><U+0000>...
^
._ncdf.c:1:8: warning: null character ignored [-Wnull-character]
<U+0000><U+0005><U+0016><U+0007><U+0000><U+0002><U+0000><U+0000>Mac OS
X <U+0000><U+0002><U+0000><U+0000>...
^
._ncdf.c:1:25: warning: null character ignored [-Wnull-character]
<U+0000><U+0005><U+0016><U+0007><U+0000><U+0002><U+0000><U+0000>Mac OS
X <U+0000><U+0002><U+0000><U+0000>...
^
._ncdf.c:1:27: warning: null character ignored [-Wnull-character]
...OS X <U+0000><U+0002><U+0000><U+0000><U+0000> <U+0000>
<U+0000><U+0000>2<U+0000><U+0000><U+0000><AC>...
^
._ncdf.c:1:28: warning: null character ignored [-Wnull-character]
...OS X <U+0000><U+0002><U+0000><U+0000><U+0000> <U+0000>
<U+0000><U+0000>2<U+0000><U+0000><U+0000><AC>...
^
(warnings and error cut from here)
96 warnings and 11 errors generated.
make: *** [._ncdf.o] Error 1
ERROR: compilation failed for package ‘ncdf’
* removing ‘/Users/xyc/Library/R/3.4/library/ncdf’
我也试过这个
$R CMD INSTALL --configure-args="-with-netcdf_incdir=/usr/local/netcdf/4.1.1-gcc/include -with-netcdf_libdir=/usr/local/netcdf/4.1.1-gcc/lib" ncdf_1.6.3.tar.gz
这也给了我96个警告和11个错误。
96 warnings and 11 errors generated.
make: *** [._ncdf.o] Error 1
ERROR: compilation failed for package ‘ncdf’
* removing ‘/Users/xyc/Library/R/3.4/library/ncdf’
看起来我仍然遇到XCode问题。
所有建议都受到高度赞赏和欢迎。
谢谢...