windows python mysql django_Python pip install django mysql在Windows上失败

在Windows10上使用Python3.5和Django1.9搭建项目时,通过pip安装MySQL支持时遇到错误。错误发生在编译MySQL-python扩展时,因找不到'config-win.h'文件导致编译失败。这可能是Python环境与MySQL Connector C的配置不匹配或缺失相关依赖导致。
摘要由CSDN通过智能技术生成

我尝试在Windows10上使用Python3.5和Django1.9设置django项目。当我运行pip命令安装MySQL支持时,我得到以下错误。MySQL 5.7已经安装并运行。在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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值