我刚刚升级到R 3.4.0并需要重新安装所有R套餐。但是,如果我运行install.packages('seewave')
,我会收到此错误:
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘seewave’
Do you want to attempt to install these from sources?
y/n: y
installing the source package ‘seewave’
trying URL 'https://www.stats.bris.ac.uk/R/src/contrib/seewave_2.0.5.tar.gz'
Content type 'application/x-gzip' length 2492482 bytes (2.4 MB)
==================================================
downloaded 2.4 MB
* installing *source* package ‘seewave’ ...
** package ‘seewave’ successfully unpacked and MD5 sums checked
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c stft.c -o stft.o
stft.c:3:11: fatal error: 'sndfile.h' file not found
# include <sndfile.h> //Library for write or read sound file
^
1 error generated.
make: *** [stft.o] Error 1
ERROR: compilation failed for package ‘seewave’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/seewave’
The downloaded source packages are in
‘/private/var/folders/5v/mwpxjb1n6qzfqp9l9t99bbl80000gn/T/Rtmpx5i071/downloaded_packages’
Warning message:
In install.packages("seewave") :
installation of package ‘seewave’ had non-zero exit status
这是sessionInfo()
的输出:
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.5
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] readxl_1.0.0 mapview_2.0.1 leaflet_1.1.0 tidyr_0.6.3 cowplot_0.7.0 GGally_1.3.0 geosphere_1.5-5
[8] broom_0.4.2 testthat_1.0.2 english_1.1-2 dplyr_0.5.0 scales_0.4.1 stargazer_5.2 combinat_0.0-8
[15] extrafont_0.17 car_2.1-4 raster_2.5-8 maptools_0.9-2 ggmap_2.6.1 ggplot2_2.2.1 rgdal_1.2-7
[22] rgeos_0.3-23 sp_1.2-4 knitr_1.16 lubridate_1.6.0 stringr_1.2.0 plyr_1.8.4 reshape2_1.4.2
loaded via a namespace (and not attached):
[1] maps_3.1.1 viridisLite_0.2.0 foreach_1.4.3 splines_3.4.0 R.utils_2.5.0 shiny_1.0.3
[7] assertthat_0.2.0 stats4_3.4.0 cellranger_1.1.0 Rttf2pt1_1.3.4 lattice_0.20-35 quantreg_5.33
[13] extrafontdb_1.0 digest_0.6.12 RColorBrewer_1.1-2 minqa_1.2.4 colorspace_1.3-2 R.oo_1.21.0
[19] htmltools_0.3.6 httpuv_1.3.3 Matrix_1.2-9 psych_1.7.5 SparseM_1.77 xtable_1.8-2
[25] webshot_0.4.0 satellite_0.2.0 jpeg_0.1-8 lme4_1.1-13 MatrixModels_0.4-1 tibble_1.3.1
[31] mgcv_1.8-17 nnet_7.3-12 lazyeval_0.2.0 gdalUtils_2.0.1.7 pbkrtest_0.4-7 mnormt_1.5-5
[37] proto_1.0.0 magrittr_1.5 crayon_1.3.2 mime_0.5 R.methodsS3_1.7.1 nlme_3.1-131
[43] MASS_7.3-47 foreign_0.8-67 tools_3.4.0 RgoogleMaps_1.4.1 munsell_0.4.3 compiler_3.4.0
[49] rlang_0.1.1 units_0.4-4 nloptr_1.0.4 iterators_1.0.8 rjson_0.2.15 htmlwidgets_0.8
[55] crosstalk_1.0.0 base64enc_0.1-3 codetools_0.2-15 gtable_0.2.0 DBI_0.6-1 reshape_0.8.6
[61] R6_2.2.1 udunits2_0.13 stringi_1.1.5 parallel_3.4.0 Rcpp_0.12.10 sf_0.4-3
[67] mapproj_1.2-4 png_0.1-7
请注意,此问题已在此处提出:‘seewave' install error “'sndfile.h' file not found” (for R 3.2.0 under OSX Yosemite)
我在终端中的这个答案中运行了各种代码,但似乎都没有。屏幕截图如下:
有人有解决方案吗?