简体   繁体   中英

Error installing Python package (leven) written in C++: g++ unrecognized command line option --output-lib

I've been trying to install this Python library for the entire day. It's called leven, and you can find it here: https://pypi.python.org/pypi/leven/ .

It was written in C++, and I am getting errors when trying to build and install it. To build and install I run from the command line: python setup.py install. It runs part of it until it fails when running the command

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

And the entire thing, when I run python setup.py install is:

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

The answer to this problem was to replace "--output-lib name" for "-out-implib=name".

I'm running into a different problem now. I need to change that --output-lib to -implib=name in the cygwinccompiler.py, so it runs when I call python setup.py install of that package, but I keep getting an extra whitespace in between implib= and name, I think this is the reason the program stops working. Any ideas for that issue?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM