windows环境 pip安装mysqlclient失败问题记录及解决方案

1.问题记录

> pip install -i https://pypi.douban.com/simple mysqlclient
Looking in indexes: https://pypi.douban.com/simple
Collecting mysqlclient
  Using cached https://pypi.doubanio.com/packages/50/5f/eac919b88b9df39bbe4a855f136d58f80d191cfea34a3dcf96bf5d8ace0a/mysqlclient-2.1.1.tar.gz
Installing collected packages: mysqlclient
  Running setup.py install for mysqlclient ... error
    ERROR: Command errored out with exit status 1:
MySQ
......
Ldb/_mysql.c(29): fatal error C1083: 无法打开包括文件: “mysql.h”: No such file or directory
 error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 

2.解决方案

直接下载安装mysqlclient whl文件进行安装
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient

在这里插入图片描述
注意:cp37即表示python3.7的版本,其他版本号同理,win32表示windows 32位的, win_amd64表示windows 64位
我这里是python3.7的版本,系统是64位所以选择mysqlclient‑1.4.6‑cp37‑cp37m‑win_amd64.whl

结果如下:

(venv) E:\project\xxx\service>pip install mysqlclient-1.4.6-cp37-cp37m-win_amd64.whl
Processing e:\project\xxx\service\mysqlclient-1.4.6-cp37-cp37m-win_amd64.whl
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.6
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值