gpt4 book ai didi

python - 如何在 Windows 上安装 python-levenshtein?

转载 作者:太空狗 更新时间:2023-10-29 17:09:44 25 4
gpt4 key购买 nike

搜索了几天之后,我准备放弃为 Python Levenshtein library 的 Python 2.7(Windows 64 位)查找预编译二进制文件。 ,所以我不是在尝试自己编译它。我已经安装了最新版本的 MinGW32(版本 0.5-beta-20120426-1)并将其设置为 distutils 中的默认编译器。

开始吧:

C:\Users\tomas>pip install python-levenshteinDownloading/unpacking python-levenshtein  Running setup.py egg_info for package python-levenshtein    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 distributionRequirement already satisfied (use --upgrade to upgrade): setuptools in c:\python27\lib\site-packages\setuptools-0.6c11-py2.7.egg (from python-levenshtein)Installing collected packages: python-levenshtein  Running setup.py install for python-levenshtein    building 'Levenshtein' extension    C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -c Levenshtein.c -o build\temp.win-amd64-2.7\Release\levenshtein.o    cc1.exe: error: unrecognized command line option '-mno-cygwin'    error: command 'gcc' failed with exit status 1    Complete output from command C:\Python27\python.exe -c "import setuptools;__file__='c:\\users\\tomas\\appdata\\local\\temp\\pip-build\\python-levenshtein\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\tomas\appdata\local\temp\pip-7txyhp-record\install-record.txt --single-version-externally-managed:    running installrunning buildrunning build_extbuilding 'Levenshtein' extensionC:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -c Levenshtein.c -o build\temp.win-amd64-2.7\Release\levenshtein.occ1.exe: error: unrecognized command line option '-mno-cygwin'error: command 'gcc' failed with exit status 1

现在我卡住了。我假设 -mno-cygwin 选项已过时并且不再对我拥有的 gcc 版本有效。如果是这样的话,我仍然不知道如何解决这个问题。

感谢任何人在此问题上提供的任何帮助。


编辑:

删除错误选项后,我手动运行了编译行:

C:\MinGW\bin\gcc.exe -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -c Levenshtein.c -o build\temp.win-amd64-2.7\Release\levenshtein.o

在构建文件夹中成功提供了 levenshtein.o,但是当我尝试运行 python setup.py install 时,它只是尝试再次构建并失败。我在哪里可以删除 -mno-cygwin?我假设它在 distutils 源中的某处,但我找不到它。

最佳答案

如果您使用 Anaconda,请尝试:

conda install -c conda-forge python-levenshtein

关于python - 如何在 Windows 上安装 python-levenshtein?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13200330/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com