美文网首页
简单解决python安装中的Unable to find vcv

简单解决python安装中的Unable to find vcv

作者: 殇不患_531c | 来源:发表于2020-10-10 22:02 被阅读0次

    配置环境时出现这个问题,原因是没有找到vcvarsall.bat。这个文件实际上的visual stdio中的,在vs的安装目录中找到VC\Auxiliary\Build\vcvarsall.bat,复制完整路径。python查询这个文件的方法在_msvccompiler.py文件中的_find_vcvarsall方法
    我使用的是conda的虚拟环境,因此进入conda安装目录的对应env中\Lib\distutils_msvccompiler.py文件中,修改:

    def _find_vcvarsall(plat_spec):
            best_dir = r'E:\tools\vs2017\VC\Auxiliary\Build'
            best_version = 17
            vcruntime = None
            vcruntime_spec = _VCVARS_PLAT_TO_VCRUNTIME_REDIST.get(plat_spec)
            if vcruntime_spec:
                vcruntime = os.path.join(best_dir,
                    vcruntime_spec.format(best_version))
                if not os.path.isfile(vcruntime):
                    log.debug("%s cannot be found", vcruntime)
                    vcruntime = None
            print(vcruntime)
            return r'E:\tools\vs2017\VC\Auxiliary\Build\vcvarsall.bat', 
    #上面这行改成你vs中vcvarsall.bat的路径
    vcruntime
    

    相关文章

      网友评论

          本文标题:简单解决python安装中的Unable to find vcv

          本文链接:https://www.haomeiwen.com/subject/ayxspktx.html