[英]nloptr version 1.2.1 installation on Window 10: error #include "nlopt.h"
I need to install nloptr
version 1.2.1 on Windows 10. Here is my code:我需要在 Windows 10 上安装nloptr
1.2.1 版。这是我的代码:
library("devtools")
install_version("nloptr", version = "1.2.1", repos = "http://cran.us.r-project.org")
And here is extract of error message:这是错误消息的摘录:
init_nloptr.c:35:10: fatal error: nlopt.h: No such file or directory
#include "nlopt.h"
^~~~~~~~~
compilation terminated.
Any work around?任何解决办法?
In fact, when installing {nloptr} from source on Windows OS, 'NLopt'
is required.实际上,在 Windows 操作系统上从源代码安装 {nloptr} 时,需要'NLopt'
。 See the description from its github source :请参阅其github 源中的描述:
For this to work on Windows, you need to have Rtools and NLopt installed, and set an environment variable NLOPT_HOME with the location of the NLopt library.要使其在 Windows 上运行,您需要安装 Rtools 和 NLopt,并使用 NLopt 库的位置设置环境变量 NLOPT_HOME。
This can be done through RTools.这可以通过 RTools 来完成。 Just open "Rtools Bash" program and execute these lines:只需打开“Rtools Bash”程序并执行以下几行:
pacman -Sy
pacman -S mingw-w64-{i686,x86_64}-nlopt
Note: pacman -Sy
is required only for refreshing Rtools packages for the first time use of "pacman".注意: pacman -Sy
仅在第一次使用“pacman”时刷新 Rtools 包时需要。
For more information, see the official instructions of pacman .更多信息请参见pacman 的官方说明。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.