在Windows中使用C绑定构建Python包(VC90)会导致LNK1181致命错误

我正在尝试构建一个绑定到C库(libspotify)的Python包(pyspotify)。

我正在使用Python 2.7.5并为某些必需的命令行工具安装了VS2008 Express。

当我从命令提示符(具有管理员权限)调用python setup.py build ,我得到以下输出:

 running build running build_py running build_ext building 'spotify._spotify' extension 

然后~18个,一个包中的每个.c文件:

 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 

然后是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 

我试图搜索这个LNK1181错误,但所有答案似乎都是关于记住字符串周围的引号,或VS中的一些设置,在这种情况下我无法控制。

您需要从此处下载相应版本的libspotify解压缩并将其放在您尝试构建的同一目录中(最简单的地方),或告诉VS在哪里找到它。