当执行下面的代码时,我得到了前面提到的错误。
我从http://www.cs.unm.edu/~mccune/prover9/download/和configure下载了所需的包。但问题仍然是一样的。
我得到了这个错误:
>>> import nltk
>>> dt = nltk.DiscourseTester(['A student dances', 'Every student is a person'])
>>> dt.readings()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/nltk/inference/discourse.py", line 351, in readings
self._construct_threads()
File "/usr/local/lib/python2.7/dist-packages/nltk/inference/discourse.py", line 297, in _construct_threads
consistency_checked = self._check_consistency(self._threads)
File "/usr/local/lib/python2.7/dist-packages/nltk/inference/discourse.py", line 393, in _check_consistency
modelfound = mb.build_model()
File "/usr/local/lib/python2.7/dist-packages/nltk/inference/api.py", line 333, in build_model
verbose)
File "/usr/local/lib/python2.7/dist-packages/nltk/inference/mace.py", line 202, in _build_model
verbose=verbose)
File "/usr/local/lib/python2.7/dist-packages/nltk/inference/mace.py", line 215, in _call_mace4
self._mace4_bin = self._find_binary('mace4', verbose)
File "/usr/local/lib/python2.7/dist-packages/nltk/inference/prover9.py", line 166, in _find_binary
verbose=verbose)
File "/usr/local/lib/python2.7/dist-packages/nltk/internals.py", line 544, in find_binary
binary_names, url, verbose))
File "/usr/local/lib/python2.7/dist-packages/nltk/internals.py", line 538, in find_binary_iter
url, verbose):
File "/usr/local/lib/python2.7/dist-packages/nltk/internals.py", line 517, in find_file_iter
raise LookupError('\n\n%s\n%s\n%s' % (div, msg, div))
LookupError:
===========================================================================
NLTK was unable to find the mace4 file!
Use software specific configuration paramaters or set the PROVER9HOME environment variable.
Searched in:
- /usr/local/bin/prover9
- /usr/local/bin/prover9/bin
- /usr/local/bin
- /usr/bin
- /usr/local/prover9
- /usr/local/share/prover9在通过make all配置LADR-2009-11时,该过程以
.o utilities.o provers.o foffer.o ../ladr/libladr.a
search.o: In function `search':
search.c:(.text+0x6e54): undefined reference to `round'
../ladr/libladr.a(avltree.o): In function `avl_item_at_position':
avltree.c:(.text+0x7cb): undefined reference to `ceil'
collect2: error: ld returned 1 exit status
make[1]: *** [prover9] Error 1
make[1]: Leaving directory `/root/Desktop/karim/software/LADR-2009-11A/provers.src'
make: *** [all] Error 2发布于 2015-11-04 07:41:34
NLTK was unable to find the mace4和
make: *** [all] Error 2也许这是显而易见的,但您需要有一个成功的LADR/Prover9构建。只有在此之后,才能使用nltk.Prover9()或nltk.MaceCommand(...)
那么为什么会有编译错误呢?在use gcc flags: -std=c99 and -lm文件中查看一些可能的答案
发布于 2017-04-23 07:51:26
用户@mircea已经回答了一个关于Prover9和Mace的类似问题。请查看Unable to Open Prover9 and Mace。这是关于设置库的路径,如下所示
prover = nltk.Prover9() prover.config_prover9(r'd:/prover9/bin')
发布于 2017-06-28 22:39:21
我通过修改nltk/inference/prover9.py文件解决了这个问题。在定义binary_locations(self)的第144行,我添加了此文件夹的路径:
C:\Program Files (x86)\Prover9-Mace4\bin-win32 (注意:不是prover文件夹,而是bin-win32子文件夹)。在那里您可以找到prover9.exe和mace4.exe文件。
最后,我不知道这是否相关,但我在这里下载了图形用户界面:http://www.cs.unm.edu/~mccune/prover9/gui/v05.html。使用windows 10
https://stackoverflow.com/questions/25844794
复制相似问题