2015-12-08 39 views
0

我想在Windows 10上使用Python 3.5和Django 1.9設置一個django項目。當我運行pip命令安裝MySQL支持時,出現以下錯誤。 MySQL 5.7已安裝並正在運行。Python pip在Windows上安裝django mysql失敗

PS H:\> pip install django mysql 
Requirement already satisfied (use --upgrade to upgrade): django in c:\python35\lib\site-packages 
Collecting mysql 
    Using cached mysql-0.0.1.tar.gz 
Collecting MySQL-python (from mysql) 
    Using cached MySQL-python-1.2.5.zip 
Installing collected packages: MySQL-python, mysql 
    Running setup.py install for MySQL-python 
    Complete output from command c:\python35\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\JKRATZ~1.EVE\\AppData\\Local\\Temp\\pip-build-kr3v2d0u\\MySQL-python\\setup.py';exec(compile(get 
attr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\JKRATZ~1.EVE\AppData\Local\Temp\pip-id62narl-record\install-record.txt --single-version-ex 
ternally-managed --compile: 
    running install 
    running build 
    running build_py 
    creating build 
    creating build\lib.win-amd64-3.5 
    copying _mysql_exceptions.py -> build\lib.win-amd64-3.5 
    creating build\lib.win-amd64-3.5\MySQLdb 
    copying MySQLdb\__init__.py -> build\lib.win-amd64-3.5\MySQLdb 
    copying MySQLdb\converters.py -> build\lib.win-amd64-3.5\MySQLdb 
    copying MySQLdb\connections.py -> build\lib.win-amd64-3.5\MySQLdb 
    copying MySQLdb\cursors.py -> build\lib.win-amd64-3.5\MySQLdb 
    copying MySQLdb\release.py -> build\lib.win-amd64-3.5\MySQLdb 
    copying MySQLdb\times.py -> build\lib.win-amd64-3.5\MySQLdb 
    creating build\lib.win-amd64-3.5\MySQLdb\constants 
    copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.5\MySQLdb\constants 
    copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.5\MySQLdb\constants 
    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.5\MySQLdb\constants 
    copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.5\MySQLdb\constants 
    copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.5\MySQLdb\constants 
    copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.5\MySQLdb\constants 
    copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.5\MySQLdb\constants 
    running build_ext 
    building '_mysql' extension 
    creating build\temp.win-amd64-3.5 
    creating build\temp.win-amd64-3.5\Release 
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Co 
nnector C 6.0.2\include" -Ic:\python35\include -Ic:\python35\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCL 
UDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\shar 
ed" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt" /Tc_mysql.c /Fobuild\temp.win-amd64-3.5\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:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2 

    ---------------------------------------- 
Command "c:\python35\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\JKRATZ~1.EVE\\AppData\\Local\\Temp\\pip-build-kr3v2d0u\\MySQL-python\\setup.py';exec(compile(getattr(tokenize, 'open', o 
pen)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\JKRATZ~1.EVE\AppData\Local\Temp\pip-id62narl-record\install-record.txt --single-version-externally-managed --compi 
le" failed with error code 1 in C:\Users\JKRATZ~1.EVE\AppData\Local\Temp\pip-build-kr3v2d0u\MySQL-python 
+0

http://stackoverflow.com/questions/1972259/can not-open-include-file-config-win -h-no-such-file-or-directory-while-inst –

回答

0

我認爲找到包含文件「config-win.h」存在問題。

請查看此錯誤消息:

_mysql.c(42): fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory 

的已包含文件移動到一個單獨的文件夾。
現在他們應定位於:

C:\ Program Files文件\的MySQL \插頭C 6.0.2 \包括

請嘗試從這個鏈接的說明:
"Cannot open include file: 'config-win.h': No such file or directory" while installing mysql-python

+0

在最新版本中似乎沒有config-win.h連接器C,除非我失去了一些東西 – greyfox

1

安裝MySQL支持在Windows上的Django正在遭受痛苦,我遇到了和你一樣的問題。對於我的情況,我使用python3.4,django1.8.5,我解決了下載文件輪這個問題從here和使用PIP進行安裝:

pip install ***.whl