《转》win7 安装ujson 出现的“error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27”

本文转载自http://blog.csdn.net/Tilyp/article/details/72842800?locationNum=2&fps=1

我的python环境是

D:\workspace\scrapy-cluster-master>python
Python 2.7.13 |Anaconda 4.3.1 (64-bit)| (default, Dec 19 2016, 13:29:36) [MSC v.
1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import sys
>>> sys.version
'2.7.13 |Anaconda 4.3.1 (64-bit)| (default, Dec 19 2016, 13:29:36) [MSC v.1500 6
4 bit (AMD64)]'
>>>

我用pip安装其他python包没有任何问题,在安装ujson时却出现了

error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27

但是我在自己的电脑上装过Visual C++ 2008 (9.0),按道理不应该出现这个错误,后来在一篇博客中看到只装vs2008还不行,还得安装一个Micorsoft Visual C++ Compiler for Python 2.7的包,下载安装之后在装ujson没有问题了。
出错的原因是ujson是c++编译的,需要c++的环境。
这里看到一张python版本需要对应的c++ 版本(注:MSC v.XXXX就是python版本号,可通过sys.version查看)

MSC v.1000 -> Visual C++ 4.x        
MSC v.1100 -> Visual C++ 5          
MSC v.1200 -> Visual C++ 6          
MSC v.1300 -> Visual C++ .NET       
MSC v.1310 -> Visual C++ .NET 2003  
MSC v.1400 -> Visual C++ 2005  (8.0)
MSC v.1500 -> Visual C++ 2008  (9.0)
MSC v.1600 -> Visual C++ 2010 (10.0)
MSC v.1700 -> Visual C++ 2012 (11.0)
MSC v.1800 -> Visual C++ 2013 (12.0)
MSC v.1900 -> Visual C++ 2015 (14.0)
MSC v.1910 -> Visual C++ 2017 (15.0)  

参考:
1, http://www.cnblogs.com/ldm1989/p/4210743.html
2, https://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat

posted @ 2018-01-30 10:20  藤露  阅读(1082)  评论(0编辑  收藏  举报