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

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

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:Python27Libdistutilsmsvc9compiler.py”文件来解决这个问题。

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

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

[python] view plain copy
 
 在CODE上查看代码片派生到我的代码片
  1. def find_vcvarsall(version):  
  2.     """Find the vcvarsall.bat file 
  3.  
  4.     At first it tries to find the productdir of VS 2008 in the registry. If 
  5.     that fails it falls back to the VS90COMNTOOLS env var. 
  6.     """  
  7.     version = 10.0  
  8.     vsbase = VS_BASE % version  
  9.     try:  
  10.         productdir = Reg.get_value(r"%sSetupVC" % vsbase,  
  11.                                    "productdir")  
  12.     except KeyError:  
  13.         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了。

原文地址:https://www.cnblogs.com/Leo_wl/p/6218574.html