问题描述
我正在尝试安装 HspellPy 包(使用 google colab): pip 安装 HspellPy (https://pypi.org/project/HspellPy/) 我明白了:
Collecting HspellPy
Using cached https://files.pythonhosted.org/packages/94/fb/d56f7809bae4a8376bc79974559a99c7deca3b3fe039acb4a4d67abd7f39/HspellPy-0.1.4.tar.gz
Building wheels for collected packages: HspellPy
Building wheel for HspellPy (setup.py) ... error
ERROR: Failed building wheel for HspellPy
Running setup.py clean for HspellPy
Failed to build HspellPy
Installing collected packages: HspellPy
Running setup.py install for HspellPy ... error
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_msu45vm/HspellPy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_msu45vm/HspellPy/setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' install --record /tmp/pip-record-lyfnm7ww/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
我查找了一些对“错误:HspellPy 的构建轮失败”的修复,但有帮助,而且由于该软件包没有被广泛使用,我找不到任何有用的东西
谢谢
解决方法
对我来说,错误的主要部分是“fatal error: hspell.h: No such file or directory”,这意味着 Hspell 没有安装(HspellPy 只是一个 Python用 C 编写的 Hspell 的包装器)。安装Hspell;在 Debian/Ubuntu 上试试
sudo apt install -y hspell
或者从 sources 编译。
然后重试pip install HspellPy
您需要安装 hspell,因为它是 HspellPy 的依赖项。
我建议直接编译源代码并确保使用 enable-linginfo 进行编译,正如我在 pypy 包描述和 github README 文件中所写的那样。 https://github.com/eranroz/HspellPy
如果您直接从源代码编译,在某些环境中上游项目 (hspell) 无法编译,您需要替换: 需要“PrefixBits.pl”;
到: 需要“./PrefixBits.pl”; 在 binarize-desc.pl 和 genprefixes.pl 中