如何在Windows 10上安装Hunspell?

8

我是Python的新手,需要在Windows 10上安装hunspell。 工具是PyCharm。

首先,我尝试安装CyHunspell:pip install CyHunspell,但是得到了以下错误消息:

RuntimeError: 'pkg-config' is not recognized as an internal or external command,operable program or batch file.

然后我尝试安装PyHunspell,但出现了以下错误消息:

ERROR: Could not find a version that satisfies the requirement PyHunspell (from versions: none)
ERROR: No matching distribution found for PyHunspell

然后我尝试直接安装hunspell,但出现了以下错误信息:
hunspell.cpp
    hunspell.cpp(20): fatal error C1083: Cannot open include file: 'hunspell.hxx': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

在我的测试代码中:
import hunspell

结果:

spellchecker = hunspell.HunSpell() failed with the following error msg:
AttributeError: module 'hunspell' has no attribute 'HunSpell'

我想我不是第一个在Windows 10上使用hunspell的人,但是我似乎找不到需要使其工作的信息。


看起来正在使用微软编译器,这意味着您没有按照项目的readme.md文件中描述的在Windows上构建它的步骤进行操作。 - martineau
感谢@Martineau。那么对于Windows10,是否有一个我可以使用的编译好的包,类似于通过pip install安装其他Python包?还是我需要按照readme.md中指定的那样,使用Mingw64和MSYS2进行编译? - LucyL
我查看了Christoph Gohlke的“Windows Python扩展包”,这是我过去多次使用的预编译包获取方式,但它没有这个包。这意味着您可能需要使用其中一个概述的方法自己构建它。 - martineau
1个回答

10
GNU Emacs文档(这里是我加下划线的)指出:此处(英文页面)。

EZWinPorts项目提供了许多最新版本GNU和Unix软件的有用端口。这包括Emacs使用的所有可选库(图像库、libxml2、GnuTLS),RCS、Texinfo、man命令克隆,Grep、xz、bzip2、bsdtar、ID Utils、Findutils、Hunspell、Gawk、GNU Make、Groff、GDB。

您确实会在sourceforge上EZWinPorts项目的文件列表中找到Hunspell。

解压后,在bin文件夹中可以找到可执行文件hunspell.exe。无需安装,该工具应在命令行上使用。您可能应该将其添加到Windows路径中。

已在我的Windows 10 PC上测试。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接