通常在官方網站下載pycrypto:html
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 (Visual Studio Version 11) SET VS90COMNTOOLS=%VS110COMNTOOLS% or with Visual Studio 2013 installed (Visual Studio Version 12) SET VS90COMNTOOLS=%VS120COMNTOOLS%python
若是你安裝的是 2012 版 SET VS90COMNTOOLS=%VS110COMNTOOLS%windows
若是你安裝的是 2013版 SET VS90COMNTOOLS=%VS120COMNTOOLS%api
或者更暴力,直接配置系統環境變量 VS90COMNTOOLS指向 %VS你的版本COMNTOOLS%併發
你還能夠更暴力,在「..python安裝路徑...\Lib\distutils目錄下有個msvc9compiler.py找到243行 網站
toolskey = "VS%0.f0COMNTOOLS" % version 直接改成 toolskey = "VS你的版本COMNTOOLS"(這個就是爲何要配 」VS90COMNTOOLS「 的緣由,由於人家文件名都告訴你了是 Microsoft vc 9的compiler, 代碼都寫死了要vc9的comntools,就要找這個玩意兒,找不到不幹活)ui
這麼作的理由是Python2.7 擴展包是能夠用08版或者更高的VS編譯的,其setup.py(安裝腳本)都是去windows系統尋找08版的VS,因此設置VS90的path操作系統