问题
I'm trying to build a Python package (pyspotify) with bindings to a C library (libspotify).
I'm using Python 2.7.5 and have installed VS2008 Express for some required commandline tools.
When I call python setup.py build
from the Command Prompt (with Admin rights) I get the following output:
running build
running build_py
running build_ext
building 'spotify._spotify' extension
And then ~18 of these, one for each .c file in the package:
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox
/MD /W3 /GS- /DNDEBUG -Isrc -Ic:\Python\Python27\include -Ic:\Python\Python27\PC
/Tcsrc\module.c /Fobuild\temp.win32-2.7\Release\src\module.obj
module.c
And then the showstopper:
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /nologo
/INCREMENTAL:NO /LIBPATH:c:\Python\Python27\libs /LIBPATH:c:\Python\Python27\PCb
uild spotify.lib /EXPORT:init_spotify build\temp.win32-2.7\Release\src\module.ob
j build\temp.win32-2.7\Release\src\session.obj build\temp.win32-2.7\Release\src\
link.obj build\temp.win32-2.7\Release\src\track.obj build\temp.win32-2.7\Release
\src\album.obj build\temp.win32-2.7\Release\src\albumbrowser.obj build\temp.win3
2-2.7\Release\src\artist.obj build\temp.win32-2.7\Release\src\artistbrowser.obj
build\temp.win32-2.7\Release\src\search.obj build\temp.win32-2.7\Release\src\pla
ylist.obj build\temp.win32-2.7\Release\src\playlistcontainer.obj build\temp.win3
2-2.7\Release\src\playlistfolder.obj build\temp.win32-2.7\Release\src\image.obj
build\temp.win32-2.7\Release\src\user.obj build\temp.win32-2.7\Release\src\pyspo
tify.obj build\temp.win32-2.7\Release\src\toplistbrowser.obj /OUT:build\lib.win3
2-2.7\spotify\_spotify.pyd /IMPLIB:build\temp.win32-2.7\Release\src\_spotify.lib
/MANIFESTFILE:build\temp.win32-2.7\Release\src\_spotify.pyd.manifest
LINK : fatal error LNK1181: cannot open input file 'spotify.lib'
error: command '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.
exe"' failed with exit status 1181
And I have tried to search for this LNK1181 error, but all answers seems to be about remembering quotes around string, or some settings in VS which I in this case has no control over.
回答1:
You need to download the appropriate version of libspotify from here unzip it and put it in the same directory that you are trying to build in, (easiest place), or tell VS where to find it.
来源:https://stackoverflow.com/questions/18296525/build-python-package-with-c-bindings-in-windows-vc90-causes-lnk1181-fatal-erro