Skip to main content
 首页 » 编程设计

python之导入模块,Levenshtein

2025年05月04日17JeffreyZhao

我正在编写一个使用比较来确定模糊匹配的脚本,因此我正在使用 Levenshtein 功能。

不幸的是,当我在终端窗口中运行 easy_install python-Levenshtein 时,当我在其上运行导入时,Python 仍然无法识别 Levenshtein。当我查看终端窗口时,我得到了这些错误代码列表(我认为这是出错的地方):

Processing python-Levenshtein-0.10.2.tar.gz

Running python-Levenshtein-0.10.2/setup.py -q bdist_egg --dist-dir /var/folders/0H/0HiEtyHBGV4TWfq84ctWC++++TM/-Tmp-/easy_install-tbdn73/python-Levenshtein-0.10.2/egg-dist-tmp-L7Jws0 warning: no files found matching '*' under directory 'docs'

warning: no previously-included files matching '*pyc' found anywhere in distribution

warning: no previously-included files matching '.project' found anywhere in distribution

warning: no previously-included files matching '.pydevproject' found anywhere in distribution

unable to execute gcc-4.0: No such file or directory

error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1

有谁知道为什么 Levenshtein 安装不起作用?我认为它与 gcc-4.0 错误有关(我运行了 GCC 安装程序,但它仍然不起作用),或者有什么建议?

请您参考如下方法:

赠品是这一行:

unable to execute gcc-4.0: No such file or directory 

这表明您没有安装 OS X 开发人员工具。您需要从 Apple 下载它们。如果幸运的话,您将能够找到仅命令行工具的下载,这就是您所需要的 - 否则您将不得不下载整个 XCode,它有几千兆字节。