Windows使用pip安装MySQL-python报错fatal error C1083: Cannot open include file: 'config-win.h'

最近用到Python爬数据,要写到MySQL里,结果安装MySQLdb库有问题

使用pip安装:

pip install MySQL-python

结果报错:

fatal error C1083: Cannot open include file: 'config-win.h' fatal error C1083: Cannot open include file: 'config-win.h'

然后查找方法,先安装了Microsoft Visual C++ Compiler for Python 2.7,附上链接:地址

结果还是报错

然后安装MySQL Connector,附上链接:MySQL Connector C

注1:这里要注意完整的报错信息,里面提到了查找‘config-win.h’的路径

因为Python是32位的,所以安装32位MySQL Connector,安装位置默认为C:\Program Files (x86)\MySQL Contractor C 6.0.2

然后成功安装MySQLdb

注2:这里要安装的是Connector/C,第一次直接安装了Connector/Python,就傻眼了

你可能感兴趣的:(python)