簡體   English   中英

在 Window 10 上安裝 nloptr 1.2.1 版:錯誤 #include "nlopt.h"

[英]nloptr version 1.2.1 installation on Window 10: error #include "nlopt.h"

我需要在 Windows 10 上安裝nloptr 1.2.1 版。這是我的代碼:

library("devtools")
install_version("nloptr", version = "1.2.1", repos = "http://cran.us.r-project.org")

這是錯誤消息的摘錄:

init_nloptr.c:35:10: fatal error: nlopt.h: No such file or directory
 #include "nlopt.h"
          ^~~~~~~~~
compilation terminated.

任何解決辦法?

實際上,在 Windows 操作系統上從源代碼安裝 {nloptr} 時,需要'NLopt' 請參閱其github 源中的描述:

要使其在 Windows 上運行,您需要安裝 Rtools 和 NLopt,並使用 NLopt 庫的位置設置環境變量 NLOPT_HOME。

這可以通過 RTools 來完成。 只需打開“Rtools Bash”程序並執行以下幾行:

pacman -Sy
pacman -S mingw-w64-{i686,x86_64}-nlopt

注意: pacman -Sy僅在第一次使用“pacman”時刷新 Rtools 包時需要。

更多信息請參見pacman 的官方說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM