_mysql.c(42) : fatal error C1083: Cannot open include file: ‘config-win.h’:问题的解决

https://blog.csdn.net/u012882134/article/details/51934165/

 

在win7下安装了python后,想安装python-mysql,使用pip安装出现如下问题:

>pip install MySQL-python

_mysql.c(42) : fatal error C1083: Cannot open include file: ‘config-win.h’: No such 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

网上一般的解释是,重新安装mysql并在安装mysql是选择安装c++的编译器。。。

我虽然没试过,但感觉肯定行不通啊,我只是想装一个可以让python远程连接mysql的包而已,管本地mysql什么事?有些解释真是误人子弟。

但错误提示里也谢了缺少C++的相关环境,后来在网上找到方法了:
方法如下:

1.在http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python下载对应的包版本,如果是win7 64位2.7版本的python,就下载

MySQL_python-1.2.5-cp27-none-win_amd64.whl

然后在命令行执行pip install MySQL_python-1.2.5-cp27-none-win_amd64.whl

当然需要在cmd下跳转到下载MySQL_python-1.2.5-cp27-none-win_amd64.whl的目录下

然后就安装成功了MySQL-python

Leave a Reply

Your email address will not be published. Required fields are marked *