如何解决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' extension

error: 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安装即可:
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值