简单解决python安装中的Unable to find vcvarsall.bat问题
使用python36安装python的murmurhash的时候遇到上述问题,原因是没有找到vcvarsall.bat。查找vcvarsall.bat的方法是定义在_msvccompiler.py文件中的(注意该文件前面是有下划线的!),比如我本地的文件路径为"C:\Program Files\Python36\Lib\distutils\_msvccompiler.py“
打开该文件,修改函数_find_vcvarsall。我本地安装的是vs2017,vcvarsall.bat的路径为“E:\tools\vs2017\VC\Auxiliary\Build\vcvarsall.bat”
_find_vcvarsall的原文如下:
def _find_vcvarsall(plat_spec):
try:
key = winreg.OpenKeyEx(
winreg.HKEY_LOCAL_MACHINE,
r"Software\Microsoft\VisualStudio\SxS\VC7",
access=winreg.KEY_READ | winreg.KEY_WOW64_32KEY
)
except OSError:
log.debug("Visual C++ is not registered")
return None, None with key:
best_version = 0
best_dir = None
for i in count():
try:
v, vc_dir, vt = winreg.EnumValue(key, i)
except OSError:
break
if v and vt == winreg.REG_SZ and os.path.isdir(vc_dir):
try:
version = int(float(v))
except (ValueError, TypeError):
continue
if version >= 14 and version > best_version:
best_version, best_dir = version, vc_dir
if not best_version:
log.debug("No suitable Visual C++ version found")
return None, None vcvarsall = os.path.join(best_dir, "vcvarsall.bat")
if not os.path.isfile(vcvarsall):
log.debug("%s cannot be found", vcvarsall)
return None, None 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 return vcvarsall, vcruntime
修改为:
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', vcruntime
直接运行python安装即可。安装完后将该文件还原
如果遇到如下问题:
- 找不到cl.exe
解决方法:将cl.exe的路径加入到系统环境变量path即可
- mmh3module.cpp(9): error C2371: “int32_t”: 重定义;不同的基类型
解决办法:这个是因为int32_t的宏定义与其他地方重复,将mmh3module.cpp,murmur_hash_3.cpp,murmur_hash_3.hpp这三个文件中的int32_t全部替换为其他名称即可,比如int32_tA(或增加#ifndef判断),保存后重新安装
简单解决python安装中的Unable to find vcvarsall.bat问题的更多相关文章
- 解决win764位安装pycrypto遇到unable to find vcvarsall.bat 问题
今天安装pycrypto的库.安装中遇到一些问题,这里简单记录下来. 首先安装python,pycrypto是基于python的一个库. 第一种:搜索关键字pycrypto,找到pycrypto的官方 ...
- pandas安装过程中提示unable to find vcvarsall.bat的解决方法
转载自:http://blog.csdn.net/qq_21144699/article/details/46849561 为这位老兄点赞 原帖参考:http://stackoverflow.com/ ...
- windows下Python扩展问题error: Unable to find vcvarsall.bat
由于对于Windows下Python扩展不熟,今天遇到一个安装问题,特此做个tag.解决方式在stackoverflow上,网址例如以下: http://stackoverflow.com/quest ...
- windows下python3.4安装lxml提示"Unable to find vcvarsall.bat"
"https://pypi.python.org/pypi/lxml/3.6.0"从这个网址直接下载对应的lxml包,exe格式的,直接安装,问题解决!
- 64位win7中使用vs2013为python3.4安装pycrypto-2.6.1插件报Unable to find vcvarsall.bat异常解决方式
问题描写叙述: 64位win7中使用vs2013为python3.4.2安装pycrypto-2.6.1插件报Unable to find vcvarsall.bat. 问题分析: 1.源代码分析,查 ...
- error: Setup script exited with error: Unable to find vcvarsall.bat
安装mxnet python版本时遇到“Unable to find vcvarsall.bat”错误搜索一下后查到如下方法: python 3.5.2版本依赖高版本的vs解决办法是安装vs2015的 ...
- windows下安装python的C扩展编译环境(解决“Unable to find vcvarsall.bat”)
个人文章除注明转载外,均为个人原创或者翻译. 个人文章欢迎各种形式的转载,但请18岁以上的转载者注明文章出处,尊重我的劳动,也尊重你的智商: 本文链接:http://www.cnblogs.com/f ...
- python安装扩展”unable to find vcvarsall.bat“的解决办法
产生原因: python3.4用的是msvs2010编译的,所以python3.4默认只能认出msvs2010以上版本 python2.7用的是msvs2008编译的,所以python2.7默认只能认 ...
- Windows下安装Python扩展模块提示Unable to find vcvarsall.bat的问题
本文内容 Unable to find vcvarsall.bat的问题描述 问题分析 总结 提示: 如果你只是想知道自己需要安装哪个版本的Visual Studio请直接查看本文最后一个小节的内容. ...
随机推荐
- POJ - 3414 bfs [kuangbin带你飞]专题一
状态搜索,每种状态下面共有六种选择,将搜索到的状态保存即可. d[i][j]表示状态A杯中水i升,B杯中水j升,总状态数量不会超过A杯的容量 * B杯的容量. AC代码 #include<cst ...
- DOCKER 无法获取使用宿主机DNS 的原因,解决方法
今天在公司服务器上部署项目,遇到一个大坑.接口怎么请求都不同,宿主机DNS已经改了.宿主可以请求,找了半天,原来是DOCKER 没有获取到主机的DNS 进去DOCKER解析不了域名 指定DNS 启动也 ...
- linux中的三个文件时间
Linux系统文件有三个主要的时间属性,分别是ctime(change time), atime(access time), mtime(modify time). 后来为了解决atime的性能问题, ...
- Mycat 分布式事务的实现
引言:Mycat已经成为了一个强大的开源分布式数据库中间件产品.面对企业应用的海量数据事务处理,是目前最好的开源解决方案.但是如果想让多台机器中的数据保存一致,比较常规的解决方法是引入"协调 ...
- HI3531串口测试程序(arm)
#include<stdio.h> unsigned int UART0_ADDR = 0x20080000; unsigned int retu=0; int i=0; void del ...
- 如何修改WinPE Boot的.wim镜像文件
1. 使用imagex /apply或imagex /mountrw将WIM镜像文件mount到某个文件夹,假设为d:\tmp\winpe_x86\mount. 例: imagex /mountrw ...
- 动手制作属于你自己的WIN PE3.0
最近想要更新公司的网Ghost系统,所以小研究一下win pe ,在网上看见一个很不错的教程,在这里分享给大家! 并非原创,纯属转载!!O(∩_∩)O~天缘的作品,很是佩服这个哥们啊..... 一.W ...
- Invalid property 'url' of bean class [com.mchange.v2.c3p0.ComboPooledDataSource]
1.错误描述 INFO:2015-05-01 13:13:05[localhost-startStop-1] - Initializing c3p0-0.9.2.1 [built 20-March-2 ...
- CSS3的[att$=val]选择器
1.实例源码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www. ...
- Linux以百万兆字节显示内存大小
Linux以百万兆字节显示内存大小 youhaidong@youhaidong-ThinkPad-Edge-E545:~$ free --tera total used free shared buf ...