win7 64 安装mysql-python:_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h

Posted 功夫 熊猫

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了win7 64 安装mysql-python:_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h相关的知识,希望对你有一定的参考价值。

 http://www.cnblogs.com/fnng/p/4115607.html

http://www.crifan.com/python_install_module_mysql_mysqldb/comment-page-1/

========================

今天想在在win7 64位环境下使用python 操作mysql

在安装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

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

Cleaning up... Command C:\\Python27\\python.exe -c "import setuptools, tokenize;__file__=\'c:\\\\use rs\\\\fnngj\\\\appdata\\\\local\\\\temp\\\\pip_build_fnngj\\\\MySQL-python\\\\setup.py\';exec(c ompile(getattr(tokenize, \'open\', open)(__file__).read().replace(\'\\r\\n\', \'\\n\'), _ _file__, \'exec\'))" install --record c:\\users\\fnngj\\appdata\\local\\temp\\pip-peervp -record\\install-record.txt --single-version-externally-managed --compile failed with error code 1 in c:\\users\\fnngj\\appdata\\local\\temp\\pip_build_fnngj\\MySQL-pyt hon Storing debug log for failure in C:\\Users\\fnngj\\pip\\pip.log

太奇怪了,以前是在ubuntu/deepin 系统可以安装。换成win7 64位就不行了。

按理说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新版本没这选项了。

 

最后不得不FQ出去看看了。

原来还是驱动问题,关人家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的事儿。

 

========================================

 

 

mysql-python install fatal error

 

http://stackoverflow.com/questions/26866147/mysql-python-install-fatal-error

 

            
         up vote12down votefavorite
8

I am trying to pip install mysql-python connector but it keeps erroring on me. Works fine on my mac and another windows machine but not this one. I have downloaded visual studio c++ and tried it as 32 bit and 64. Does anyone have an idea on how to get around this.

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

error: command \'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio 9.0\\\\VC\\\\BIN\\\\c
l.exe\' failed with exit status 2

----------------------------------------
Cleaning up...
Command C:\\Users\\Admin1\\Desktop\\python\\virtual\\Scripts\\python.exe -c "import set
uptools, tokenize;__file__=\'C:\\\\Users\\\\Admin1\\\\Desktop\\\\python\\\\virtual\\\\build\\\\
MySQL-python\\\\setup.py\';exec(compile(getattr(tokenize, \'open\', open)(__file__).r
ead().replace(\'\\r\\n\', \'\\n\'), __file__, \'exec\'))" install --record c:\\users\\admin
1\\appdata\\local\\temp\\1\\pip-6pmwrd-record\\install-record.txt --single-version-ext
ernally-managed --compile --install-headers C:\\Users\\Admin1\\Desktop\\python\\virtu
al\\include\\site\\python2.7 failed with error code 1 in C:\\Users\\Admin1\\Desktop\\py
thon\\virtual\\build\\MySQL-python
Storing debug log for failure in C:\\Users\\Admin1\\pip\\pip.log
share|improve this question
 
3                                                                                  
Take a look at this : stackoverflow.com/questions/1972259/…                    – Alexander                 Nov 11 \'14 at 13:37                                                                            
                                                                                                                    
Thank you. That did the trick                     – Chris Meek                 Nov 11 \'14 at 13:58                                                                            
                                                                                                                    
try to install it from an executable setup file. (it\'s force installation and sometimes ignores the error).                     – Reza-S4                 Apr 16 \'15 at 5:30                                                                            

1 Answer                                 1

         up vote21down voteaccepted

for 64-bit windows

share|improve this answer
 
                                                                                                                    
i success with the 32bit one,thanks                     – V-SHY                 Jul 23 \'15 at 6:27                                                                            
                                                                                                                    
This was successful for me with all versions.  Also make sure to download the .whl file to the same directory you execute the pip install call from.                     – sir_gelato                 Jul 26 \'15 at 6:07                                                                            
                                                                                                                    
pip install MySQL_python-1.2.5-cp27-none-win_amd64.whl did the job for me. Thanks a lot.                     – sridhar249                 Feb 21 at 22:42                                                                            
                                                                                                                    
pip install mysqlclient-1.3.7-cp35-none-win_amd64.whl worked for me. Thanks a lot!                     – Mirjalal Talishinski                 Mar 6 at 19:52                                                                            
                                                                                                                    
Wow! Would give you 100 votes if that was possible. I had been struggling with this issue for 3 hours!                     – slashCoder                 Mar 22 at 7:56                                                                            

 

以上是关于win7 64 安装mysql-python:_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h的主要内容,如果未能解决你的问题,请参考以下文章

mysql-python安装问题(在ma​​c os x lion上)

关于windows x64安装MySQL-python失败解决

ubuntu 12.04下无法安装MySQL-python

win7系统64为安装jdktomcat

window64位安装mysql-python

解决windows64位系统上安装mysql-python报错