Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
452 views
in Technique[技术] by (71.8m points)

window - Visual C++ for Python failed with exit status 2

  File "c:usersuserappdatalocalemppip_build_userssdeep.eggscff
i-1.8.2-py2.7-win32.eggcffiffiplatform.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

Cleaning up... Command python setup.py egg_info failed with error code 1 in c:users


I keep getting this error. I have tried multiple other solutions on here but no luck. Am I missing something. Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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%LocalProgramsCommonMicrosoft".
  4. I copied the contents of
    • "...Visual C++ for Python9.0VCinclude"to the "C:Python27include"
    • "...Visual C++ for Python9.0VClib"to "C:Python27libs"
    • "...Visual C++ for Python9.0WinSDKInclude" to "C:Python27include"
    • "...Visual C++ for Python9.0WinSDKlib" to "C:Python27libs"
  5. I edited path in environmental variables to include these two directories ("C:Python27include" and "C:Python27libs". I think this step is not essential).
  6. Edit the "msvc9compiler.py" in the directory "C:Python27Libdistutils"
    • Line # ~270 hard coded link to "vcvarsall.bat" "%appdata%..Visual C++ for Python9.0vcvarsall.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 Python9.0VCBincl.exe" (caution: it is Bin and not in.)
    • Line # ~403 Similar to above hard coded the link to self.linker.

Doing the above steps worked for me.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...