通过终端Mac运行SWI Prolog

时间:2015-07-01 12:38:03

标签: macos terminal prolog swi-prolog

我正试图从终端运行prolog。我已经安装了7.2.2版,并使用以下命令将其添加到我的环境路径中:

PATH=$PATH:/Applications/SWI-Prolog.app/Contents/MacOS

然后开始我输入

swipl

但是会返回此错误:

Illegal instruction: 4

我是新手,请帮助我。我知道我可以通过双击它来运行应用程序,但我在终端工作时感觉更舒服..

我的Mac版本是Mac OS X Lion 10.7.5(11G63)

2 个答案:

答案 0 :(得分:12)

我在应用程序文件夹中删除了GUI版本。不需要它从命令行运行SWI-Prolog。只需转到终端窗口并输入:

brew tap homebrew/x11

执行上述命令后,输入:

brew install swi-prolog --HEAD

现在swipl应该有效:

Maryams-MacBook-Pro:~ maryam$ swipl

返回

Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.3.3)
Copyright (c) 1990-2015 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

耶!准备好出发。我们来测试一下:

?- ['/Users/maryam/Downloads/familyTree.pl'].

true.

答案 1 :(得分:1)

您可以尝试按如下方式安装Swi-prolog:

sudo port -d selfupdate

sudo port install swi-prolog

在此之后,您可以在

处检查已安装的Swi-prolog(swipl)
/opt/local/bin/

现在它应该可行

swipl




Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.2.2)
 Copyright (c) 1990-2015 University of Amsterdam, VU Amsterdam
 SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
 and you are welcome to redistribute it under certain conditions.
 Please visit http://www.swi-prolog.org for details.

 For help, use ?- help(Topic). or ?- apropos(Word).

 ?-