且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Windows7下pip安装包报错:Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat

更新时间:2022-09-03 21:45:58

Windows7下pip安装包报错:Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat

在Windows7x64下使用pip安装包的时候提示报错:Microsoft Visual C++ 9.0 is required  (Unable to find vcvarsall.bat)

如果你的系统没有VS2008的话,可以安装一个Micorsoft Visual C++ Compiler for Python 2.7的包,如果安装了更高版本的VS的话,可以通过修改“C:\Python27\Lib\distutils\msvc9compiler.py”文件来解决这个问题。

可以通过注册表查看你安装的版本号:

Windows7下pip安装包报错:Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat

然后修改文件中的“find_vcvarsall(version)”函数,添加一句“version = 10.0”;10.0为你安装的版本号。

def find_vcvarsall(version):
    """Find the vcvarsall.bat file

    At first it tries to find the productdir of VS 2008 in the registry. If
    that fails it falls back to the VS90COMNTOOLS env var.
    """
    version = 10.0
    vsbase = VS_BASE % version
    try:
        productdir = Reg.get_value(r"%s\Setup\VC" % vsbase,
                                   "productdir")
    except KeyError:
        productdir = None
但这个问题解决之后还是不能安装,又遇到问题:_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h':no such file or directory

下载安装包安装又遇到:Python Version 2.7 required which was not found in the registry

最后直接去下载64位的安装包就OK了。