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
文章来源:https://www.toymoban.com/news/detail-673321.html
结果如下:文章来源地址https://www.toymoban.com/news/detail-673321.html
(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
到了这里,关于windows环境 pip安装mysqlclient失败问题记录及解决方案的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!