【Python】安装.whl类库报错“XXX is not a supported wheel on this platform”的解决方案

问题

今天在部署系统时,需要安装类库“MarkupSafe-1.1.1-cp37-cp37m-macosx_10_6_intel.whl”,在CentOS7.6系统执行安装命令“pip3 install MarkupSafe-1.1.1-cp37-cp37m-macosx_10_6_intel.whl”,提示错误。

【Python】安装.whl类库报错“XXX is not a supported wheel on this platform”的解决方案

解决

经查阅资料,修改包名“MarkupSafe-1.1.1-cp37-cp37m-macosx_10_6_intel.whl”至“MarkupSafe-1.1.1-cp37-none-any.whl”,然后安装成功。

【Python】安装.whl类库报错“XXX is not a supported wheel on this platform”的解决方案

举一反三

经测试,此解决方案也可解决其它.whl包在安装过程中遇到的同样问题。

【Python】安装.whl类库报错“XXX is not a supported wheel on this platform”的解决方案

推广

最后,在win7+Python3.6环境下,也可以直接用相同的方法安装Python类库。

【Python】安装.whl类库报错“XXX is not a supported wheel on this platform”的解决方案

参考

https://www.cnblogs.com/nice-forever/p/5371906.html