问题描述:

pip instal MySQL-python

出现如下错误:

Installing collected packages: MySql-python
Running setup.py install for MySql-python
......
_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\\cl.exe' failed with exit status 2

运行环境:

python 2.7.10

setuptools 41.0.1

pip 19.1

操作系统:Windows7  64位

解决办法:

1) 安装mysql connector, 可根据系统版本选择安装32位或64位的, 下载地址:

http://dev.mysql.com/downloads/connector/c/6.0.html#downloads

2) 安装Microsoft Visual C++ Compiler for Python 2.7,要是安装mysql-python需要乃至vc的一些运行库,下载地址:

http://www.microsoft.com/en-us/download/confirmation.aspx?id=44266

(参考博客:http://blog.csdn.net/xxm524/article/details/47360229)

按上面步骤安装好依赖相关软件后, 再次运行pip install MySQL-python又遇到了以下问题

_mysql.c

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

error: command '"C:\Users\fnngj\AppData\Local\Programs\Common\Microsoft\Visual C ++ for Python\9.0\VC\Bin\amd64\cl.exe"' failed with exit status 2

按理说win7都出来这么多年了,python也更新的这么猛的语言,怎么链接mysql就不行了。

百度了半天,找到了以下答案:

----------------------------------------------

1)问题:_mysql.c(34) : fatal error C1083: Cannot open include file: ‘config-win.h’: No such file or directory error: command ‘”C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe”‘ failed with exitstatus 2

原因:原因是安装MySQL的时候没有安装C语言库。

解决:重新运行MySQL的安装程序,选择Modify,把“C Include Files / Lib Files”勾选上,并安装。

---------------------------------------------

百度来百度去,就这么一个答案,都是复制粘贴的。害我反复把mysql装了几遍,跟本他妈的没找到“C Include Files / Lib Files” 选项在哪儿? 也许是mysql新版本没这选项了。

原来还是驱动问题,关人家mysql啥事儿!

安装:MySQL-python-1.2.3.win-amd64-py2.7.exe 点击下载就可以了(或者百度csdn下载可以找到)

我的驱动是从这儿下的,不行!

https://pypi.python.org/pypi/MySQL-python/

也用 pip 装了,不行!

C:\Python27\Scripts>pip install MySQL-python

这pip居然检测不出我的系统版本。 还有为啥python官网搜索不到这个 64位的驱动,我也是醉了。

希望这个问题被百度收录,遇到这个问题的人,别在被上面的答案忽悠了,真不管人家mysql的事儿。

更新~~  现在都2019年了,不用再纠结这个问题了,请使用 PyMySQL 驱动

https://github.com/PyMySQL/PyMySQL

但笔者却再次遇到了这个问题, 仔细看了下错误信息发现有如下提示:

C:\Users\Administrator\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\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" -II:\Python27\include -II:\Python27\PC /Tc_mysql.c /Fobuild\temp.win32-2.7\Release\_mysql.obj /Zl  

之前安装的mysql connector是64位的, 安装到了C:\Program Files \MySQL\MySQL Connector C 6.0.2目录,但从提示中看它要的是安装到C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2,因此应该安装32位的mysql connector;

重新安装32位的mysql connector, 重新执行pip install MySQL-python, 安装成功!

总结一下,造成上述的主要原因是: 系统中安装的python、pip 都是32位。

参考文章:

http://www.cnblogs.com/yuguoguo/p/4089427.html

http://blog.csdn.net/xxm524/article/details/47360229

mysql-python 安装错误: Cannot open include file: 'config-win.h': No such file or directory的更多相关文章

  1. grep: /usr/include/php/main/php.h: No such file or directory

    异常 grep: /usr/include/php/main/php.h: No such file or directory grep: /usr/include/php/Zend/zend_mod ...

  2. Solve error: Cannot open include file: 'X11/Xlocale.h': No such file or directory

    When you use FLTK with VS2010, you may get the error: fatal error C1083: Cannot open include file: ' ...

  3. MySQL编译安装错误:No curses/termcap library found的解决方法

    CentOS编译安装MySQL,./coonfigure时出现错误: checking for termcap functions library... configure: error: No cu ...

  4. 编译boost python模块遇到的错误:../../libraries/boost_1_44_0/boost/python/detail/wrap_python.hpp:75:24: fatal error: patchlevel.h: No such file or directory

    就是遇到类似标题上面的错误. 原因是没有安装对应python的python-dev依赖,不然编译到boost python模块的时候就会出错. 所以解决方案是sudo apt-get install ...

  5. MySQL编译安装错误提示合集

    1>安装mysql在初始化的时候,出现/usr/local/mysql/bin/mysqld:error while loading shared libraries:libaio.so.1 : ...

  6. 解决python安装错误问题

    遇到的问题描述: An error occurred during the installation of assemblyA Microsoft.VC90. CRT, version=9-0.307 ...

  7. /usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory

    https://stackoverflow.com/questions/39111930/usr-include-boost-python-detail-wrap-python-hpp5023-fat ...

  8. MySQL - ODBC安装错误问题!

    MySQL的ODBC安装时候可能会出错,主要原因是缺少VC支持库,需要2010版本的VC支持库!!X86和X64分别对应MySQL对应的ODBC,不能安装一个两个都搞定,如果需要安装两个ODBC驱动, ...

  9. MYSQL常见安装错误集:[ERROR] --initialize specified but the data directory has files in it. Abort

    1.[ERROR] --initialize specified but the data directory has files in it. Abort [错误] -初始化指定,但数据目录中有文件 ...

随机推荐

  1. 13-Node.js学习笔记-MongoDB

    数据库相关概念 在一个数据库软件最终可以包含多个数据仓库,在每个数据仓库中可以包含多个数据集合,每个数据集合中可以包含多条文档(具体的数据) database: 数据库,mongoDB数据库软件中可以 ...

  2. TCP 连接与 HTTP 请求的相关问题

    1.现代浏览器在与服务器建立了一个 TCP 连接后是否会在一个 HTTP 请求完成后断开?什么情况下会断开? 默认情况下建立 TCP 连接不会断开,只有在请求报头中声明 Connection: clo ...

  3. Dubbo学习系列之六(微服务架构实战)

    看了最近文章的反馈,似乎波澜不惊的样子,应该是看官觉得都是小菜,那我就直上硬菜,人狠话不多,开始!准备:Idea201902/JDK11/ZK3.5.5/Gradle5.4.1/RabbitMQ3.7 ...

  4. C# 结合 PInvoke 对接 IP 摄像头的笔记

    最近做项目的时候,需要对接厂商提供的 IP 摄像头.但是他们只提供了 C++ 的 SDK,没办法,只能开始撸 C# 的 SDK Helper 类.本篇文章主要记录了对接 C++ DLL 需要注意的几个 ...

  5. Provide Several View Variants for End-Users 为最终用户提供多个视图变体

    In this lesson, you will learn how to provide several customized variants of the same View, and allo ...

  6. UML简单介绍—类图详解

    类图详解 阅读本文前请先阅读:UML简单介绍—类图这么看就懂了 1.泛化关系 一个动物类: /** * 动物类 */ public class Animal { public String name; ...

  7. 升级python2.7至python3.7

    最近在centos7下执行命令时,出现以下提示: DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020 ...

  8. 安装CentOS 6.x报错"Disk sda contains BIOS RAID metadata"解决方法

    今天在安装CentOS 6.2的时候,当进到检测硬盘的时候,总是过不去,报错如下: Disk sda contains BIOS RAID metadata, but is not part of a ...

  9. 阿里云ubuntu16.04搭建pptpd

    一.搭建pptp vpn 需开放1723端口和gre协议 1.阿里云有个安全组需要开放端口才能访问,需添加新的安全组规则. 登陆阿里云服务器管理控制台,添加安全组规则 入/出方向都填写 端口范围为17 ...

  10. [洛谷P1169][题解][ZJOI2007]棋盘制作

    我不是题目的说 这道题运用了一种很巧妙的DP方式:悬线法 如图,蓝色为悬线,黄色为向两边延伸的长度 那么显然,最大子矩形的宽一定是这些黄线中最小的(证明从略) 所以我们可以维护三个数组: Up[i][ ...