【发布时间】:2020-07-29 08:16:02
【问题描述】:
我有一个使用 Python 3.8 的 django 项目,我正在尝试通过:pip install mysqlclient 命令安装 mysqlclient 库。我收到了这个错误:
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
- 我尝试使用来自哪里的轮子文件进行安装(我尝试了这个site 中的每个轮子)但我得到了错误:
*...is not a supported wheel on this platform.* - 我试图从source 安装它,但是当我运行这个命令
python setup.py install时,我得到了同样的错误:
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
-
我尝试了这个命令
pip install --only-binary :all: mysqlclient,我得到了错误:找不到满足mysqlclient要求的版本(来自版本:) 没有找到 mysqlclient 的匹配分布
如果您有任何建议,请告诉我。谢谢!
【问题讨论】:
-
让我一一解释这些错误。 "无法打开包含文件:'mysql.h'" 你需要
libmysqlclient的源代码。 “此平台上不支持的滚轮”要么您下载了其他 Python 版本的滚轮,要么您有 32/64 位问题(32 位 Python 和 64 位滚轮;或 64 位Python 和 32 位轮子);下载与您的 Python 对应的正确轮子。 -
"找不到满足 mysqlclient 要求的版本(来自版本:)没有为 mysqlclient 找到匹配的发行版"
mysqlclient项目 provides wheels 仅适用于 64 位蟒蛇。可能你有32位。安装 64 位 Python。