[摘要:題目描繪: pip instal MySQL-python 涌現如下毛病: Installing collected packages: MySql-python Running setup.py install for MySql-python ...... _mysq]html
pip instal MySQL-pythonpython
出現以下錯誤:mysql
Installing collected packages: MySql-python Running setup.py install for MySql-python ...... _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory error: command 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
python 2.7.10sql
setuptools 16.0 ui
pip 7.0.1操作系統
操做系統:Windows10.0.10240 64位.net
1) 安裝mysql connector, 可根據系統版本選擇安裝32位或64位的, 下載地址:code
http://dev.mysql.com/downloads/connector/c/6.0.html#downloadshtm
2) 安裝Microsoft Visual C++ Compiler for Python 2.7,要是安裝mysql-python須要乃至vc的一些運行庫,下載地址:blog
http://www.microsoft.com/en-us/download/confirmation.aspx?id=44266
(參考前面寫博客:http://blog.csdn.net/xxm524/article/details/47360229)
按上面步驟安裝好依賴相關軟件後, 再次運行pip install MySQL-python應該就會執行成功;
但筆者卻再次遇到了這個問題, 仔細看了下錯誤信息發現有以下提示:
C:\Users\Administrator\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -II:\Python27\include -II:\Python27\PC /Tc_mysql.c /Fobuild\temp.win32-2.7\Release\_mysql.obj /Zl
以前安裝的mysql connector是64位的, 安裝到了C:\Program Files \MySQL\MySQL Connector C 6.0.2目錄,但從提示中看它要的是安裝到C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2,所以應該安裝32位的mysql connector;
從新安裝32位的mysql connector, 從新執行pip install MySQL-python, 安裝成功!
總結一下,形成上述的主要緣由是: 系統中安裝的python、pip 都是32位。
參考文章:
http://www.cnblogs.com/yuguoguo/p/4089427.html
http://blog.csdn.net/xxm524/article/details/47360229