Visual C++ for Python failed with exit status 2--转载自stackoverflow

File "c:\users\user\appdata\local\temp\pip_build_user\ssdeep\.eggs\cff
i-1.8.2-py2.7-win32.egg\cffi\ffiplatform.py", line 65, in _build
    raise VerificationError('%s: %s' % (e.__class__.__name__, e))

cffi.ffiplatform.VerificationError: CompileError: command 'C:\\Users\\user\\
AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin
\\cl.exe' failed with exit status 2

A crude method worked for me. Perhaps someone with knowledge can optimize the answer:

  1. Read the following article Link
  2. Mine is Python 2.7. I followed the article and installed the Visual C++ compiler for python 2.7. Install Link
  3. This installs a folder in your "%AppData%\Local\Programs\Common\Microsoft".
  4. I copied the contents of
    • "...\Visual C++ for Python\9.0\VC\include"to the "C:\Python27\include"
    • "...\Visual C++ for Python\9.0\VC\lib"to "C:\Python27\libs"
    • "...\Visual C++ for Python\9.0\WinSDK\Include" to "C:\Python27\include"
    • "...\Visual C++ for Python\9.0\WinSDK\lib" to "C:\Python27\libs"
  5. I edited path in environmental variables to include these two directories ("C:\Python27\include" and "C:\Python27\libs". I think this step is not essential).
  6. Edit the "msvc9compiler.py" in the directory "C:\Python27\Lib\distutils"
    • Line # ~270 hard coded link to "vcvarsall.bat" "%appdata%..\Visual C++ for Python\9.0\vcvarsall.bat"
    • Line # ~394 os.environ['include'] = "C:\\Python27\\include"
    • Line # ~396 os.environ['lib'] = "C:\\Python27\\libs"
    • Line # ~402 hard coded the link to self.cc = "...\Visual C++ for Python\9.0\VC\Bin\cl.exe" (caution: it is \Bin and not \bin.)
    • Line # ~403 Similar to above hard coded the link to self.linker.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值