zoukankan      html  css  js  c++  java
  • solution for "cannot find vcvarsall.bat" in Python

    When building some package with python in windows, the command is

    python setup.py build

    However, if you use Visual Studio as the compiler, sometime there is an error shown as :

    error: Unable to find vcvarsall.bat

    But VS has been installed in this computer, has not it?

    The error is from a logical error in the distutils of python.
    In the file of msvc9compiler.py, there is a function called: get_build_version. In this function is used to get the version of VS that is used to build your python, and the value are used as the VS version in your computer. It does not make sense at all!

    A solution is to find the version of VS in your computer from register. The code as followed:


    def get_build_version():
    """Return the version of MSVC in your computer.
    """
    p = r"Software\Wow6432Node\Microsoft\VisualStudio"
    for base in HKEYS:
    try:
    h = RegOpenKeyEx(base, p)
    except RegError:
    continue
    key = RegEnumKey(h, 0)
    if key:
    return float(key)
    return None
  • 相关阅读:
    java架构之路-(面试篇)Mysql面试大全
    web工程的路径问题详解
    SQL知识点总结
    Mybatis简介
    mysql大全
    配置心得
    spring4.1.3+springmvc+mybatis3.2.1整合
    jstl标签
    jstl标签库
    Java并发控制机制
  • 原文地址:https://www.cnblogs.com/xueliangliu/p/2962165.html
Copyright © 2011-2022 走看看