解决python3.8安装mysqlclient失败的问题

解决Python3.8安装mysqlclient失败的技巧
在尝试使用PIP在线安装mysqlclient时遇到失败。为了解决这个问题,可以从网址https://www.lfd.uci.edu/~gohlke/pythonlibs/#entropy下载相应版本的whl文件。然而,直接本地安装仍不成功。关键在于注意到问题出在'cp38m',将下载的whl文件名中的'cp38'改为'cp38m',然后安装即告成功。
部署运行你感兴趣的模型镜像

PIP在线安装失败

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?

(venv) D:\djangoall\education\edu>pip install wheel
Collecting wheel
  Using cached https://files.pythonhosted.org/packages/8c/23/848298cccf8e40f5bbb59009b32848a4c38f4e7f3364297ab3c3e2e2cd14/wheel-0.34.2-py2.py3-none-any.whl
Installing collected packages: wheel
Successfully installed wheel-0.34.2

(venv) D:\djangoall\education\edu>pip install mysqlclient-1.4.6-cp38-cp38-win_amd64.whl
mysqlclient-1.4.6-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.

https://www.lfd.uci.edu/~gohlke/pythonlibs/#entropy
下载对应版本的whl文件,本地安装还是失败
怎么办?
进入python环境下

>>> 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')]
>>>

问题就出现在cp38m这里,下载的whl文件是cp38,果断改 cp38m

(venv) D:\djangoall\education\edu>pip install mysqlclient-1.4.6-cp38-cp38m-win_amd64.whl
Processing d:\djangoall\education\edu\mysqlclient-1.4.6-cp38-cp38m-win_amd64.whl
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.6

安装成功!
如果这个心得帮到了你解决了这个问题,来个赞~:)共勉!

您可能感兴趣的与本文相关的镜像

Stable-Diffusion-3.5

Stable-Diffusion-3.5

图片生成
Stable-Diffusion

Stable Diffusion 3.5 (SD 3.5) 是由 Stability AI 推出的新一代文本到图像生成模型,相比 3.0 版本,它提升了图像质量、运行速度和硬件效率

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值