无法在Python中使用ctypes导入NHunspell.dll

时间:2013-06-25 06:06:12

标签: python-2.7 ctypes hunspell nhunspell

我需要导入一个名为'NHunspell.dll'的dll,用于拼写检查。我正在使用 Python 作为软件。 虽然我检查了几个网站以正确使用ctypes,但我无法正确加载dll。

当我使用此代码时。

  from ctypes import *
  hunspell = cdll.LoadLibrary['NHunspell.dll']

我收到错误

  hunspell = cdll.LoadLibrary['NHunspell.dll']
  TypeError: 'instancemethod' object has no attribute '__getitem__'

我想这可能是dll结构的问题。但我不知道如何正确导入DLL。

1 个答案:

答案 0 :(得分:0)

谢谢@eryksun。但它仍然没有奏效。我使用了一个名为 Pyhunspell 的Hunspell的Python包装器。 PyPi中的实际链接不适用于Python 2.7,但已在here中进行了改进和升级。