使用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问题的更多相关文章

  1. 解决win764位安装pycrypto遇到unable to find vcvarsall.bat 问题

    今天安装pycrypto的库.安装中遇到一些问题,这里简单记录下来. 首先安装python,pycrypto是基于python的一个库. 第一种:搜索关键字pycrypto,找到pycrypto的官方 ...

  2. pandas安装过程中提示unable to find vcvarsall.bat的解决方法

    转载自:http://blog.csdn.net/qq_21144699/article/details/46849561 为这位老兄点赞 原帖参考:http://stackoverflow.com/ ...

  3. windows下Python扩展问题error: Unable to find vcvarsall.bat

    由于对于Windows下Python扩展不熟,今天遇到一个安装问题,特此做个tag.解决方式在stackoverflow上,网址例如以下: http://stackoverflow.com/quest ...

  4. windows下python3.4安装lxml提示"Unable to find vcvarsall.bat"

    "https://pypi.python.org/pypi/lxml/3.6.0"从这个网址直接下载对应的lxml包,exe格式的,直接安装,问题解决!

  5. 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.源代码分析,查 ...

  6. error: Setup script exited with error: Unable to find vcvarsall.bat

    安装mxnet python版本时遇到“Unable to find vcvarsall.bat”错误搜索一下后查到如下方法: python 3.5.2版本依赖高版本的vs解决办法是安装vs2015的 ...

  7. windows下安装python的C扩展编译环境(解决“Unable to find vcvarsall.bat”)

    个人文章除注明转载外,均为个人原创或者翻译. 个人文章欢迎各种形式的转载,但请18岁以上的转载者注明文章出处,尊重我的劳动,也尊重你的智商: 本文链接:http://www.cnblogs.com/f ...

  8. python安装扩展”unable to find vcvarsall.bat“的解决办法

    产生原因: python3.4用的是msvs2010编译的,所以python3.4默认只能认出msvs2010以上版本 python2.7用的是msvs2008编译的,所以python2.7默认只能认 ...

  9. Windows下安装Python扩展模块提示Unable to find vcvarsall.bat的问题

    本文内容 Unable to find vcvarsall.bat的问题描述 问题分析 总结 提示: 如果你只是想知道自己需要安装哪个版本的Visual Studio请直接查看本文最后一个小节的内容. ...

随机推荐

  1. 记录 serverSocket socket 输入,输出流,关闭顺序,阻塞,PrintWriter的一些问题.

    关于socket.getOutputStream() 的一些问题, OutputStream的flush是一个空方法,所以需要另一个实现了Flush的流来包装一下 这里为什么使用PrintWriter ...

  2. Day5模块-shutil模块

    参考博客:http://www.cnblogs.com/wupeiqi/articles/4963027.html shutil模块是高级的文件.文件夹.压缩处理的模块.比如文件的copy.压缩等. ...

  3. Linux CentOS安装配置MySQL数据库

    没什么好说的,直接正面刚吧. 安装mysql数据库 a)下载mysql源安装包:wget http://dev.mysql.com/get/mysql57-community-release-el7- ...

  4. sizeof计算空间大小的总结

    sizeof,看起来还真不简单,总结起来还是一大堆的东西,不过这是笔试面试中出现比较频繁的,我也是考过才觉得很重要,有些规则如果不注意,还真是拿到一道题目摸不着头脑,所有总结一下,方面忘记的时候瞄一瞄 ...

  5. 3.3.2 PCI设备对不可Cache的存储器空间进行DMA读写

    在x86处理器和PowerPC处理器中,PCI设备对"不可Cache的存储器空间"进行DMA读写的过程并不相同.其中PowerPC处理器对"不可Cache的存储器空间&q ...

  6. configure: error: xml2-config not found. Please check your libxml2 installation

    安装php时的报错 checking libxml2 install dir... nochecking for xml2-config path... configure: error: xml2- ...

  7. R语言︱机器学习模型评估方案(以随机森林算法为例)

    笔者寄语:本文中大多内容来自<数据挖掘之道>,本文为读书笔记.在刚刚接触机器学习的时候,觉得在监督学习之后,做一个混淆矩阵就已经足够,但是完整的机器学习解决方案并不会如此草率.需要完整的评 ...

  8. 【html5】html5离线存储

    html5本地存储之离线存储 1.为什么使用离线存储 ①最新的主流的浏览器中都已添加了对HTML5的offline storage功能的支持,HTML5离线存储功能非常强大, 它的作用是:在用户没有与 ...

  9. java.sql.SQLException:Column Index out of range,0<1

    1.错误描述 java.sql.SQLException:Column Index out of range,0<1 2.错误原因 try { Class.forName("com.m ...

  10. Linux显示工作路径

    Linux显示工作路径 youhaidong@youhaidong-ThinkPad-Edge-E545:~$ pwd /home/youhaidong