本文主要是介绍如何解决Windows系统下pip安装包错误Unable to find vcvarsall.bat,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
简介
在Windows系统上,通过pip安装Python包时,会报"error: Unable to find vcvarsall.bat"错误。手工安装时,也会有同样的问题:
> python setup.py install
running build_ext
building 'dulwich._objects' extensionerror: Unable to find vcvarsall.bat
问题分析
为生成Python包的二进制轮子(binary wheel),需要安装编译器和系统头文件。Microsoft Visual C++ Compiler for Python 2.7提供了包含了需要的编译器和系统头文件集,这样就可以不需要访问C编译器,便可在任何Windows系统上安装Python包的二进制轮子。如果你没有安装这个编译器包,遇到的典型的错误就是"Unable to find vcvarsall.bat“。
下面是官方关于此包的详细说明:
This package contains the compiler and set of system headers necessary for producing binary wheels for Python packages. A binary wheel of a Python package can then be installed on any Windows system without requiring access to a C compiler.
The typical error message you will receive if you need this compiler package is Unable to find vcvarsall.bat
This message appears because the Python package being installed contains the source code for a native extension module (.pyd), but does not have a pre-built copy of the module. The Python packages highlighted at pythonwheels.com have already been updated by their developers to include pre-built binaries, but many are still only available as source code.
This compiler package is entirely unsupported and represents a snapshot of the last version that is fully compatible with Python 2.7. For the latest security and bug fixes, please use the latest version of Microsoft Visual Studio for any development work that does not directly interface with Python 2.7.
解决方案
去微软官网下载VCForPython27.msi安装即可:
http://www.microsoft.com/en-us/download/details.aspx?id=44266
这篇关于如何解决Windows系统下pip安装包错误Unable to find vcvarsall.bat的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!