简体   繁体   中英

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.

From the path showing up in the error message, it looks like you're running on macOS.

If so, you must install the nlopt system library before installing nloptr .

Hopefully you have Homebrew installed (if not, please reply/comment and I will attach some further info), hence open the Terminal and run

brew install nlopt

At the end of the brew install command, go back to R and install nloptr .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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