標籤:sql download pip安裝 x86 local cannot temp deb nec
問題表述:
pip install MySQL-python==1.2.5
出現如下報錯:
C:\Users\Administrator\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\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" -IC:\Python27\include -Ic:\progra~2\jetbra~1\python~1\saplat~1\PC /Tc_mysql.c /Fobuild\temp.win-amd64-2.7\Release\_mysql.obj /Zl _mysql.c _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\\amd64\\cl.exe‘ failed with exit status 2
運行環境:
windows 10 x64
Python 2.7.14
pip 9.0.1
解決辦法:
看pip的安裝報錯有關於"MySQL Connector C 6.0.2",需要安裝對應的驅動包,見下,
在win7下安裝了python後,想安裝python-mysql,使用pip安裝出現如下問題:
pip install MySQL-python
build\lib.win-amd64-2.7\_mysql.pyd : fatal error LNK1120: 56 unresolved externalserror: command ‘C:\\Users\\Administrator\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\link.exe‘ failed with exit status 1120
網上一般的解釋是,重新安裝mysql並在安裝mysql是選擇安裝c++的編譯器。。。
我雖然沒試過,但感覺肯定行不通啊,我只是想裝一個可以讓python遠端連線mysql的包而已,管本地mysql什麼事?有些解釋真是誤人子弟。
但錯誤提示裡也謝了缺少C++的相關環境,後來在網上找到方法了:
方法如下:
1.在 http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python 下載對應的包版本,如果是win7 64位2.7版本的python,就下載
MySQL_python-1.2.5-cp27-none-win_amd64.whl
然後在命令列執行pip install MySQL_python-1.2.5-cp27-none-win_amd64.whl
當然需要在cmd下跳轉到下載MySQL_python-1.2.5-cp27-none-win_amd64.whl的目錄下
然後就安裝成功了MySQL-python
- 參考連結:
http://www.cnblogs.com/fnng/p/4115607.html
windows python MySQL-python安裝過程