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:\Python27\Lib\distutils\msvc9compiler.py”文件來解決這個問題。
可以通過注冊表查看你安裝的版本號:
然后修改文件中的“find_vcvarsall(version)”函數,添加一句“version = 10.0”;10.0為你安裝的版本號。
- def find_vcvarsall(version):
- """Find the vcvarsall.bat file
- At first it tries to find the productdir of VS 2008 in the registry. If
- that fails it falls back to the VS90COMNTOOLS env var.
- """
- version = 10.0
- vsbase = VS_BASE % version
- try:
- productdir = Reg.get_value(r"%s\Setup\VC" % vsbase,
- "productdir")
- except KeyError:
- 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了。