简体   繁体   English

如何处理R中的nloptr错误?

[英]How can I deal with this nloptr error in R?

init_nloptr.c:35:10: fatal error: 'nlopt.h' file not found
#include "nlopt.h"
         ^~~~~~~~~
1 error generated.
make: *** [init_nloptr.o] Error 1
ERROR: compilation failed for package 'nloptr'
* removing '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/nloptr'
Warning in install.packages :
  installation of package 'nloptr' had non-zero exit status
I got this error message when I installed nloptr package which need to install mi package. 我在安装需要安装mi软件包的nloptr软件包时收到此错误消息。

From the path showing up in the error message, it looks like you're running on macOS. 从错误消息中显示的路径来看,好像您在macOS上运行。

If so, you must install the nlopt system library before installing nloptr . 如果是这样,您必须安装nlopt安装前的系统库nloptr

Hopefully you have Homebrew installed (if not, please reply/comment and I will attach some further info), hence open the Terminal and run 希望您已经安装了Homebrew(如果未安装,请回复/评论,我会附加一些信息),因此请打开终端并运行

brew install nlopt

At the end of the brew install command, go back to R and install nloptr . brew install命令的末尾,返回R并安装nloptr

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM