gpt4 book ai didi

python - 安装用 C++ : g++ unrecognized command line option --output-lib 编写的 Python 包 (leven) 时出错

转载 作者:行者123 更新时间:2023-11-28 05:56:39 24 4
gpt4 key购买 nike

我一整天都在尝试安装这个 Python 库。它叫做 leven,您可以在这里找到它:https://pypi.python.org/pypi/leven/ .

它是用 C++ 编写的,我在尝试构建和安装它时遇到错误。要构建和安装,我从命令行运行:python setup.py install。它运行其中的一部分,直到运行命令时失败

C:\Program Files (x86)\CodeBlocks\MinGW\bin\g++.exe -mdll -static --entry _DllMain@12 --output-lib build\temp.win32-2.7\Release\leven\lib_levenshtein.a --def build\temp.win32-2.7\Release\leven\_levenshtein.def -s build\temp.win32-2.7\Release\leven\_levenshtein.o -LC:\Python27\libs -LC:\Python27\PCbuild -lpython27 -lmsvcr90 -o build\lib.win32-2.7\leven\_levenshtein.pyd
g++: error: unrecognized command line option '--output-lib'
g++: error: build\temp.win32-2.7\Release\leven\lib_levenshtein.a: No such file or directory
error: command 'C:\\Program Files (x86)\\CodeBlocks\\MinGW\\bin\\g++.exe' failed with exit status 1

当我运行 python setup.py install 时,整个过程是:

C:\Python27\Lib\site-packages>python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to leven.egg-info\requires.txt
writing leven.egg-info\PKG-INFO
writing top-level names to leven.egg-info\top_level.txt
writing dependency_links to leven.egg-info\dependency_links.txt
reading manifest file 'leven.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'leven.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
running build_ext
building 'leven._levenshtein' extension
C:\Program Files (x86)\CodeBlocks\MinGW\bin\gcc.exe -mdll -O -Wall -Ileven -IC:\Python27\include -IC:\Python27\PC -c leven/_levenshtein.cpp -o build\temp.win32-2.7\Release\leven\_levenshtein.o
leven/_levenshtein.cpp: In function 'void __Pyx_RaiseArgtupleInvalid(const char*, int, Py_ssize_t, Py_ssize_t, Py_ssize_t)':
leven/_levenshtein.cpp:1400:59: warning: unknown conversion type character 'z' in format [-Wformat]
leven/_levenshtein.cpp:1400:59: warning: format '%s' expects argument of type 'char*', but argument 5 has type 'Py_ssize_t {aka int}' [-Wformat]
leven/_levenshtein.cpp:1400:59: warning: unknown conversion type character 'z' in format [-Wformat]
leven/_levenshtein.cpp:1400:59: warning: too many arguments for format [-Wformat-extra-args]
writing build\temp.win32-2.7\Release\leven\_levenshtein.def
C:\Program Files (x86)\CodeBlocks\MinGW\bin\g++.exe -mdll -static --entry _DllMain@12 --output-lib build\temp.win32-2.7\Release\leven\lib_levenshtein.a --def build\temp.win32-2.7\Release\leven\_levenshtein.def -s build\temp.win32-2.7\Release\leven\_levenshtein.o -LC:\Python27\libs -LC:\Python27\PCbuild -lpython27 -lmsvcr90 -o build\lib.win32-2.7\leven\_levenshtein.pyd
g++: error: unrecognized command line option '--output-lib'
g++: error: build\temp.win32-2.7\Release\leven\lib_levenshtein.a: No such file or directory
error: command 'C:\\Program Files (x86)\\CodeBlocks\\MinGW\\bin\\g++.exe' failed with exit status 1

最佳答案

这个问题的答案是用“-out-implib=name”替换“--output-lib name”。

我现在遇到了一个不同的问题。我需要在 cygwinccompiler.py 中将 --output-lib 更改为 -implib=name,这样当我调用该包的 python setup.py install 时它就会运行,但我不断得到一个额外的空格在 implib= 和名称之间,我认为这是程序停止工作的原因。对这个问题有什么想法吗?

关于python - 安装用 C++ : g++ unrecognized command line option --output-lib 编写的 Python 包 (leven) 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34037899/

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