我尝试使用以下方法安装Rglpk
包
install.packages("Rglpk")
但得到以下信息:
Package which is only available in source form, and may need compilation of
C/C++/Fortran: 'Rglpk'
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source package 'Rglpk'
trying URL 'https://cran.rstudio.com/src/contrib/Rglpk_0.6-3.tar.gz'
Content type 'application/x-gzip' length 20892 bytes (20 KB)
==================================================
downloaded 20 KB
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_TIME failed, using "C"
3: Setting LC_MESSAGES failed, using "C"
4: Setting LC_MONETARY failed, using "C"
* installing *source* package 'Rglpk' ...
** package 'Rglpk' successfully unpacked and MD5 sums checked
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_TIME failed, using "C"
3: Setting LC_MESSAGES failed, using "C"
4: Setting LC_MONETARY failed, using "C"
Error in dyn.load("conftest.so") :
unable to load shared object '/private/var/folders/kg/05p23mln6bg7rt8d3jryc30w0000gn/T/RtmpXw7Z3J/R.INSTALL282d4ddc1f3b/Rglpk/conftest.so':
dlopen(/private/var/folders/kg/05p23mln6bg7rt8d3jryc30w0000gn/T/RtmpXw7Z3J/R.INSTALL282d4ddc1f3b/Rglpk/conftest.so, 6): Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib
Referenced from: /usr/local/opt/glpk/lib/libglpk.40.dylib
Reason: image not found
Execution halted
** libs
/bin/sh: line 0: cd: GLPK: No such file or directory
make: *** [GLPK.ts] Error 1
ERROR: compilation failed for package 'Rglpk'
* removing '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rglpk'
Warning in install.packages :
installation of package 'Rglpk' had non-zero exit status
The downloaded source packages are in
'/private/var/folders/kg/05p23mln6bg7rt8d3jryc30w0000gn/T/RtmpHmhPNf/downloaded_packages'
我使用brew
来安装glpk
。虽然链接存在一些问题,但似乎有效:
MacOS USER$ brew link glpk
Linking /usr/local/Cellar/glpk/4.65... 5 symlinks created
对出现问题的任何想法?
答案 0 :(得分:1)
具有相同的问题,除了通过自制软件安装GLPK之外,您还需要激活依赖项。在通过R控制台安装Rglpk和通过自制软件glpk之后,在R控制台中键入以下内容:
install.packages(“ Rglpk”,dependencies = TRUE)
应该可以解决问题
答案 1 :(得分:0)
我认为你的上一个自制程序命令安装了glpk库,根据SOF,下一步是将它运行到终端xcode-select --install
,它应该安装得很好。