不正狼 发表于 2015-4-27 12:58:02

python Unable to find vcvarsall.bat 错误

  今天遇到了这个方面的问题,目前找到两种办法。一种是换编译器如mingw,另一种是装vc。第一种方法没成功,现在正在等第二种。
  第一种:
  首先安装MinGW;
  把MinGW的路径添加到环境变量path中,比如MinGW安装在D:\MinGW\中,就把D:\MinGW\bin添加到path中;
  打开命令行窗口,在命令行窗口中进入到要安装代码的目录下;
  输入如下命令就可以安装了。setup.py install build --compiler=mingw32
  
  第二种:
  今天在安装pyscopg2库的时候出现Unable to find vcvarsall.bat错误,在网上找了一会儿,有人说是要装mingw来解决,我试了,但是不行后来找到另一种解决办法:
1、到http://www.microsoft.com/express/Downloads/#2008-Visual-CPP去下载visual c++ 2008 express edition
2、然后安装,之后再重新python setup.py install就好了
这个应该是个通用的方法,假如你在安装其他库的时候也遇到 Unable to find vcvarsall.bat错误的时候,应该也可以解决

  我的以上方法都不管用,看到stackoverflow有一种方法:
  For Windows installations:
  While running setup.py for package installations Python 2.7 searches for an installed Visual Studio 2008. You can trick Python to use a newer Visual Studio by setting the correct path in VS90COMNTOOLS environment variable before calling setup.py.
  If you have Visual Studio 2010 installed, execute
  SET VS90COMNTOOLS=%VS100COMNTOOLS%
  or with Visual Studio 2012 installed
  SET VS90COMNTOOLS=%VS110COMNTOOLS%
  我的是vs2010,在cmd下设置一下变量就可以了。
  更多参考:http://www.biaodianfu.com/python-error-unable-to-find-vcvarsall-bat.html
  http://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat
页: [1]
查看完整版本: python Unable to find vcvarsall.bat 错误