pip install mysqlclient 失败

1、报错信息:

ySQLdb/_mysql.c /Fobuild\temp.win-amd64-cpython-38\Release\src/MySQLdb/_mysql.obj
_mysql.c
src/MySQLdb/_mysql.c(29): fatal error C1083: 无法打开包括文件: “mysql.h”: No such file or directory
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mysqlclient
Failed to build mysqlclient
ERROR: Failed to build installable wheels for some pyproject.toml based projects (mysqlclient)

2、解决:手动安装mysqlclient 文件,到以下地址下载对应的python版本文件,我的python版本是3.8.找到当前是cp38的文件下载:

Links for mysqlclient:https://pypi.tuna.tsinghua.edu.cn/simple/mysqlclient/

完整下载地址:https://pypi.tuna.tsinghua.edu.cn/packages/a8/c4/2c4befb6f78f7b05ad4b1ea725a878738c7908285730838c5e6925eabf89/mysqlclient-1.4.6-cp38-cp38-win_amd64.whl#sha256=f646f8d17d02be0872291f258cce3813497bc7888cd4712a577fd1e719b2f213

3、安装

pip install .\mysqlclient-1.4.6-cp38-cp38-win_amd64.whl

4、成功安装

 

posted @ 2025-05-09 18:40  狂奔的狼  阅读(288)  评论(0)    收藏  举报