简体   繁体   English

无法在django 1.11中将mysql与python 2.7连接在一起,同时安装mysqlclient和MySQL-python时出错

[英]Not able to connect mysql with python 2.7 in django 1.11 getting error while installing mysqlclient and MySQL-python both

i am trying to install mysql client to connect mysql with python 2.7 for django project but getting error, even i tried MySQL-python connector to install but getting error there also. 我正在尝试安装mysql客户端,以将python 2.7与mysql连接到django项目,但出现错误,即使我尝试安装MySQL-python连接器也出现错误。

C:\Users\syedabdul\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dve
rsion_info=(1,3,12,'final',0) -D__version__=1.3.12 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" -Ic:\python27\include -Ic:\pyt
hon27\PC /Tc_mysql.c /Fobuild\temp.win32-2.7\Release\_mysql.obj /Zl
    _mysql.c
    _mysql.c(29) : fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
    error: command 'C:\\Users\\syedabdul\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with
exit status 2

    ----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\syedab~1\\appdata\\local\\temp\\pip-build-xgy30p\\mysqlc
lient\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))
" install --record c:\users\syedab~1\appdata\local\temp\pip-rs9dvc-record\install-record.txt --single-version-externally-managed --compile" fail
ed with error code 1 in c:\users\syedab~1\appdata\local\temp\pip-build-xgy30p\mysqlclient\

我建议您使用pypi.python.org为您的系统使用适当的官方python wheel,然后通过pip install MySQLConnector2.7.whl进行安装,假定MySQLConnector2.7.whl是文件名

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM