【发布时间】:2018-05-26 12:49:36
【问题描述】:
我尝试使用以下方法安装 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
对出了什么问题有什么想法吗?
【问题讨论】:
-
我猜你没有为在你的 OsX 上构建软件设置所需的 C 文件,但是 brew 为你做了,所以回答并接受你的解决方案,使用 brew 来实现结果,你的最后一个代码输入,这将结束这个问题,你会获得一些积分。
-
皮埃尔,你解决了你的问题。在您的答案中写下您的解决方案
MacOS USER$ brew link glpk Linking /usr/local/Cellar/glpk/4.65... 5 symlinks created,并接受您自己的答案。那么这个有解决方案的问题就不会作为一个未回答的问题而徘徊。 -
它不起作用,我在 R 中仍然有相同的消息。完全相同。
-
我在 R 中有这个错误消息,我用谷歌搜索它,我找到了我安装的 brew 解决方案。但它仍然不起作用,我不明白我用 brew 做了什么以及它应该做什么。我认为路径有问题,因为错误中的这一行:引用自:/usr/local/opt/glpk/lib/libglpk.40.dylib 原因:找不到图像
-
请儿子帮帮我?