nltk无法找到mace4

时间:2014-09-15 09:27:28

标签: python nltk

执行下面的代码时,我收到的错误如上所述。

我从http://www.cs.unm.edu/~mccune/prover9/download/下载了所需的软件包并进行了配置。但仍然是同样的问题。

我收到此错误:

>>> 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

5 个答案:

答案 0 :(得分:0)

NLTK was unable to find the mace4

make: *** [all] Error 2

也许这很明显,但你需要成功构建LADR / Prover9。只有在此之后,您才能使用nltk.Prover9()nltk.MaceCommand(...)

那么为什么会出现编译错误?在您的make文件中use gcc flags: -std=c99 and -lm查看一些可能的答案

答案 1 :(得分:0)

用户@mircea已经回答了关于Prover9和Mace的类似问题。看看Unable to Open Prover9 and Mace。它是关于设置库的路径,如

prover = nltk.Prover9() prover.config_prover9(r'd:/prover9/bin')

答案 2 :(得分:0)

我通过修改nltk / inference / prover9.py文件修复了我的问题。在第144行中,定义了binary_locations(self)我添加了此文件夹的路径:

C:\Program Files (x86)\Prover9-Mace4\bin-win32(注意:不是证明文件夹,而是bin-win32子文件夹)。在那里,您会找到prover9.exemace4.exe文件。

最后,我不知道这是否相关,但我下载了这里的GUI:http://www.cs.unm.edu/~mccune/prover9/gui/v05.html。使用Windows 10

答案 3 :(得分:0)

今天我遇到了同样的问题。通过将-lm移动到涉及-lm的所有行中的行尾来修复它。在Makefile中修改文件LADR-2009-11A/provers.src,使其如下所示:

 65 prover9: prover9.o $(OBJECTS)
 66     $(CC) $(CFLAGS) -o prover9 prover9.o $(OBJECTS) ../ladr/libladr.a -lm
 67
 68 fof-prover9: fof-prover9.o $(OBJECTS)
 69     $(CC) $(CFLAGS) -o fof-prover9 fof-prover9.o $(OBJECTS) ../ladr/libladr.a -lm
 70
 71 ladr_to_tptp: ladr_to_tptp.o $(OBJECTS)
 72     $(CC) $(CFLAGS) -o ladr_to_tptp ladr_to_tptp.o $(OBJECTS) ../ladr/libladr.a -lm
 73
 74 tptp_to_ladr: tptp_to_ladr.o $(OBJECTS)
 75     $(CC) $(CFLAGS) -o tptp_to_ladr tptp_to_ladr.o $(OBJECTS) ../ladr/libladr.a -lm
 76
 77 autosketches4: autosketches4.o $(OBJECTS)
 78     $(CC) $(CFLAGS) -o autosketches4 autosketches4.o $(OBJECTS) ../ladr/libladr.a -lm
 79
 80 newauto: newauto.o $(OBJECTS)
 81     $(CC) $(CFLAGS) -o newauto newauto.o $(OBJECTS) ../ladr/libladr.a -lm
 82
 83 newsax: newsax.o $(OBJECTS)
 84     $(CC) $(CFLAGS) -o newsax newsax.o $(OBJECTS) ../ladr/libladr.a -lm

答案 4 :(得分:0)

这对我有用。我在github issue 193

上找到的

简介

  • 下载gui
  • 下载dll
  • 将下载的dll放入C:\Program Files (x86)\Prover9-Mace4
  • 创建Windows系统环境变量PROVER9并将其设置为C:\Program Files (x86)\Prover9-Mace4\bin-win32