安装mysqlclient错误处理

使用 pip install mysqlclient 爆出 building 'MySQLdb._mysql' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/ 错误

解决记录

https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient 下载对应的whl文件。

获取支持版本号

>>> import pip._internal
>>> print(pip._internal.pep425tags.get_supported())
[('cp38', 'cp38m', 'win_amd64'), ('cp38', 'none', 'win_amd64'), ('py3', 'none', 'win_amd64'), ('cp38', 'none', 'any'), ('cp3', 'none', 'any'), ('py38', 'none', 'any'), ('py3', 'none', 'any'), ('py37', 'none', 'any'), ('py36', 'none'
, 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')]

安装

这里我下载了 mysqlclient‑1.4.6‑cp38‑cp38‑win_amd64.whl
然后使用 pip install mysqlclient‑1.4.6‑cp38‑cp38‑win_amd64.whl 还是报错

将 whl 文件改名为 mysqlclient-1.4.6-cp38-none-win_amd64.whl 再次安装

原文地址:https://www.cnblogs.com/depycode/p/15374488.html