python编译c代码,在Python中编译C代码的问题

I use Anaconda for Python 2.7.10 in Windows 7, 64 bit. I also use Visual Studio 2010. I installed Microsoft Visual Studio for Python.

When I try to compile a C code in python (inside cmd):

C:\Anaconda\sms-tools-master\software\transformations_interface>python compileModule.py build_ext --inplace

I get a lot of warnings and some errors that the final part of it are as follows:

C:\Program Files (x86)\Microsoft Visual Studio

10.0\VC\BIN\amd64\link.exe /DLL / nologo /INCREMENTAL:NO /LIBPATH:C:\Anaconda\libs /LIBPATH:C:\Anaconda\PCbuild\am d64 m.lib

/EXPORT:initutilFunctions_C build\temp.win-amd64-2.7\Release\utilFunct

ions.obj build\temp.win-amd64-2.7\Release\cutilFunctions.obj

/OUT:C:\Anaconda\sm

s-tools-master\software\models\utilFunctions_C\utilFunctions_C.pyd

/IMPLIB:build \temp.win-amd64-2.7\Release\utilFunctions_C.lib

/MANIFESTFILE:build\temp.win-amd

64-2.7\Release\utilFunctions_C.pyd.manifest LINK : fatal error

LNK1181: cannot open input file 'm.lib' error: command 'C:\\Program

Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\ amd64\\link.exe'

failed with exit status 1181

Please let me see how this problem can be fixed.

解决方案

Comment the line in setup.py that say libraries=['m'], and run again.

The need to link to m might be a GCC thing to link Math library, that is managed by MSVCR in Windows environment.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值