关于windows安装mysqclient报错

来源:互联网 发布:mysql数据库常用命令 编辑:程序博客网 时间:2024/06/05 23:44

最近在学习django,发现安装mysqlclient包时老是老错,机器是win 10 64位的,在命令行里输入pip install mysqlclient,发现一直安装不上,报错信息如下:

    _mysql.c(29) : fatal error C1083: Cannot open include file: 'my_config.h': No such file or directory
    error: command 'C:\\Users\\liguangyao\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2

然后网上找相关资料,网上的教程是下载mysql connector,然后手动将mysqlclient源码里的site.cfg,以及setup_windows.py的关于connector的路径给改成我们安装的mysql connector的路径,改过之后发现还是不行,估计是源码是linux的,而我们系统是windows的。

之后进入mysqlclient的github页,上面有提示:Wheels for Windows may be not released with source package. You should pin version in your requirements.txt to avoid trying to install newest source package.

上面提示了最好避免用最新的源码包来安装,安装的时候指定版本号就ok啦,我们在github找到历时版本:https://github.com/PyMySQL/mysqlclient-python/releases,找到最新的windows支持的版本,下载下来,pip install成功。我们安装最新的版本是:1.3.9

原创粉丝点击