构建Python包与C绑定在Windows(VC90)导致LNK1181致命错误 [英] Build Python package with C bindings in Windows (VC90) causes LNK1181 fatal error

查看:2251
本文介绍了构建Python包与C绑定在Windows(VC90)导致LNK1181致命错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个Python包(pyspotify)与绑定C库(libspotify)。

I'm trying to build a Python package (pyspotify) with bindings to a C library (libspotify).

我使用Python 2.7.5,并已经安装VS2008前preSS对于一些需要命令行工具。

I'm using Python 2.7.5 and have installed VS2008 Express for some required commandline tools.

当我称之为蟒蛇setup.py构建从命令提示符(具有管理员权限)我得到以下的输出:

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

然后〜这些18,一个包中的每个.c文件:

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

然后是搅局者:

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一些设置。

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.

推荐答案

您需要从的 将它解压缩,并把它放在你正在试图建立在同一个目录,(最容易的地方),或者告诉VS哪里可以找到它。

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.

这篇关于构建Python包与C绑定在Windows(VC90)导致LNK1181致命错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆