lua/torch (OS X) 的 Gnu 绘图错误

Posted

技术标签:

【中文标题】lua/torch (OS X) 的 Gnu 绘图错误【英文标题】:Gnu plot error with lua/torch (OS X) 【发布时间】:2016-01-25 06:43:16 【问题描述】:

我想在 Torch 中运行一些需要 gnuplot 库的代码,但是出现以下错误;

/Users/mattsmith/torch/install/bin/luajit: ...attsmith/torch/install/share/lua/5.1/gnuplot/gnuplot.lua:127: Gnuplot terminal is not set
stack traceback:
    [C]: in function 'error'
    ...attsmith/torch/install/share/lua/5.1/gnuplot/gnuplot.lua:127: in function 'getfigure'
    ...attsmith/torch/install/share/lua/5.1/gnuplot/gnuplot.lua:808: in function 'figure'
    ...attsmith/torch/install/share/lua/5.1/gnuplot/gnuplot.lua:288: in function 'getCurrentPlot'
    ...attsmith/torch/install/share/lua/5.1/gnuplot/gnuplot.lua:308: in function 'writeToCurrent'
    ...attsmith/torch/install/share/lua/5.1/gnuplot/gnuplot.lua:836: in function 'gnulplot'
    ...attsmith/torch/install/share/lua/5.1/gnuplot/gnuplot.lua:976: in function 'plot'
    practical3.lua:217: in main chunk
    [C]: in function 'dofile'
    ...mith/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
    [C]: at 0x0104467190

我在这里读到Lua Error: "Gnuplot terminal is not set" 我需要安装 gnu plot 可执行文件。所以我下载了这个并按照这里的网站说明http://gnuplot.sourceforge.net/ReleaseNotes_5_0.html 然后我得到了这个错误;

In file included from ./term.h:414:
../term/lua.trm:113:10: fatal error: 'lua.h' file not found
#include <lua.h>
         ^
1 error generated.
make[3]: *** [term.o] Error 1
make[2]: *** [install-recursive] Error 1
make[1]: *** [install] Error 2
make: *** [install-recursive] Error 1

不太确定我是否以正确的方式进行处理。任何帮助将不胜感激!

谢谢

【问题讨论】:

install options used in the official dependency script 可能是您实现它所需要的。 【参考方案1】:

查找 lua.h 所在的位置。对我来说,它在:/usr/local/Cellar/lua/5.3.5_1/include/lua

然后,打开gnuplot安装文件里面的lua.trm,找到#include lua.h,替换成path/lua.h。就我而言:/usr/local/Cellar/lua/5.3.5_1/include/lua/lua.h

您会注意到还有其他“包含”会抛出与 lua.h 相同的错误。都在同一条路上。因此,以相同的方式修改包含。

【讨论】:

以上是关于lua/torch (OS X) 的 Gnu 绘图错误的主要内容,如果未能解决你的问题,请参考以下文章

如何在Apple OS X 10.5 Leopard上构建和安装GNU wget

尝试在 OS X 上为 32 位和 64 位编译 GNU 库

当从 `torch.class` 方法将`self` 返回到控制台时,为啥 Lua/Torch 会耗尽内存?

sh 在OS X上安装GNU程序https://www.topbug.ne​​t/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-m

sh 在OS X上安装GNU程序https://www.topbug.ne​​t/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-m

sh 在OS X上安装GNU程序https://www.topbug.ne​​t/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-m