You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

R中geomorph及依赖mvtnorm包安装失败求助

修复geomorph安装失败的问题

首先,你的核心问题是缺少Fortran编译器,导致依赖包mvtnorm无法从源码编译安装,进而卡住了geomorph的安装流程。以下是具体的修复步骤:

  • 第一步:安装Xcode命令行工具
    打开终端,输入以下命令并按回车,按照提示完成安装(这会提供基础的编译环境):

    xcode-select --install
    
  • 第二步:安装适配High Sierra的gfortran编译器
    你的MacOS是High Sierra,需要下载对应版本的gfortran安装包(比如gfortran 6.1版本,完美适配该系统),运行安装包完成编译器配置。

  • 第三步:优先安装二进制版本的mvtnorm
    安装mvtnorm时,直接指定安装预编译好的二进制版本,跳过源码编译环节:

    install.packages("mvtnorm", type = "binary")
    
  • 第四步:重新安装geomorph
    依赖问题解决后,再次执行安装命令即可:

    install.packages("geomorph")
    

你的原始问题回顾

我尝试在R中安装几何形态测量包geomorph,但每次安装都会出现如下错误信息:

> install.packages("geomorph") 
There is a binary version available but the source version is later:
        binary source needs_compilation
geomorph 3.0.5  3.0.6              FALSE
installing the source package ‘geomorph’

trying URL 'https://cran.rstudio.com/src/contrib/geomorph_3.0.6.tar.gz'
Content type 'application/x-gzip' length 545863 bytes (533 KB)
==================================================
downloaded 533 KB

Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
  unknown timezone 'default/America/Toronto'
* installing *source* package ‘geomorph’ ...
** package ‘geomorph’ successfully unpacked and MD5 sums checked
** R
** data
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
  there is no package called ‘mvtnorm’
ERROR: lazy loading failed for package ‘geomorph’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/geomorph’
Warning in install.packages :
  installation of package ‘geomorph’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/4p/m9yg9rg94v13j49zxnp9kzzh0000gn/T/RtmpCBCHAn/downloaded_packages’

我使用RStudio进行操作,也尝试过直接用R,已升级至最新MacOS HighSierra,试过重启应用程序、安装并重启XQuartz,但目前所有尝试均无效。我在2015年初款MacBook Air上运行R,已无解决思路,欢迎提供任何建议。

编辑补充:尝试安装mvtnorm也失败

报错信息如下:

> install.packages("mvtnorm")
There is a binary version available but the source version is later:
        binary source needs_compilation
mvtnorm  1.0-6  1.0-7              TRUE
Do you want to install from sources the package which needs compilation? y/n: y
installing the source package ‘mvtnorm’

trying URL 'https://cran.rstudio.com/src/contrib/mvtnorm_1.0-7.tar.gz'
Content type 'application/x-gzip' length 159381 bytes (155 KB)
==================================================
downloaded 155 KB

* installing *source* package ‘mvtnorm’ ...
** package ‘mvtnorm’ successfully unpacked and MD5 sums checked
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG - I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC - Wall -mtune=core2 -g -O2 -c C_FORTRAN_interface.c -o C_FORTRAN_interface.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG - I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC - Wall -mtune=core2 -g -O2 -c miwa.c -o miwa.o
gfortran-4.8 -fPIC -g -O2 -c mvt.f -o mvt.o
make: gfortran-4.8: No such file or directory
make: *** [mvt.o] Error 1
ERROR: compilation failed for package ‘mvtnorm’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/mvtnorm’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/mvtnorm’
Warning in install.packages :
  installation of package ‘mvtnorm’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/4p/m9yg9rg94v13j49zxnp9kzzh0000gn/T/RtmpCBCHAn/downloaded_packages’

内容的提问来源于stack exchange,提问作者William Bell

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 04:15:54