標籤:visual c++python 2.7
安裝pip install MySQL-python 故障解決!
running build_ext building ‘_mysql‘ extension error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Get it from http://aka.ms/vcpython27 ----------------------------------------Command "C:\Python27\python.exe -u -c "import setuptools, tokenize;__file__=‘c:\\users\\gaogd\\appdata\\local\\temp\\pip-build-btgsva\\MySQL-python\\setup.py‘;exec(compile(getattr(tokenize, ‘open‘, open)(__file__).read().replace(‘\r\n‘, ‘\n‘), __file__, ‘exec‘))" install --record c:\users\gaogd\appdata\local\temp\pip-ijueoq-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\gaogd\appdata\local\temp\pip-build-btgsva\MySQL-pythonC:\Users\gaogd>
下載安裝:
Windows下pip安裝包報錯:Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat剛在機器上windows環境下裝上pip方便以後安裝包的時候使用,誰知道第一次使用pip安裝asyncio的時候就報錯。在Windows7x64下使用pip安裝包的時候提示報錯:Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat)環境:windows7 x64 ,python2.7 ,VS2012原因:windows下使用pip安裝包的時候需要機器裝有vs2008,VS2012還不行,如果不想裝VS2008的話,可以安裝一個Micorsoft Visual C++ Compiler for Python 2.7的包
http://www.microsoft.com/en-us/download/details.aspx?id=44266
錯誤2
650) this.width=650;" src="http://s4.51cto.com/wyfs02/M02/86/11/wKioL1e0CVaxFV70AABeKDHmqU0369.png-wh_500x0-wm_3-wmp_4-s_969539620.png" title="11.png" alt="wKioL1e0CVaxFV70AABeKDHmqU0369.png-wh_50" />
解決:執行下面指令碼:
import sys from _winreg import * # tweak as necessary version = sys.version[:3] installpath = sys.prefix regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version) installkey = "InstallPath" pythonkey = "PythonPath" pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % ( installpath, installpath, installpath ) def RegisterPy(): try: reg = OpenKey(HKEY_CURRENT_USER, regpath) except EnvironmentError as e: try: reg = CreateKey(HKEY_CURRENT_USER, regpath) SetValue(reg, installkey, REG_SZ, installpath) SetValue(reg, pythonkey, REG_SZ, pythonpath) CloseKey(reg) except: print "*** Unable to register!" return print "--- Python", version, "is now registered!" return if (QueryValue(reg, installkey) == installpath and QueryValue(reg, pythonkey) == pythonpath): CloseKey(reg) print "=== Python", version, "is already registered!" return CloseKey(reg) print "*** Unable to register!" print "*** You probably have another Python installation!" if __name__ == "__main__": RegisterPy()
顯示“python 2.7 is already registered”
再安裝setuptools的時候,就能自動識別出來python2.7了。
win7是 64的原因,在安裝python(32位)時,如果選擇只為目前使用者,以上問題是不會出現的,如果選擇所有使用者,那就用上面的方法解決吧。
分類: Python
本文出自 “奮鬥吧” 部落格,請務必保留此出處http://lvnian.blog.51cto.com/7155281/1839549
python 安裝 mysql-python故障