Python程序教程

您现在的位置是:首页 >  Python

当前栏目

Python安装whl文件之坑「建议收藏」

Python,安装,whl,文件,之坑,建议,收藏
2025-03-28 09:01:06 时间

大家好,又见面了,我是你们的朋友全栈君。

有的时候,使用pip install xxx会失败,这个时候我们就需要下载xxx.whl文件,而xxx.whl在版本上有很多不兼容的地方需要注意

1.whl文件兼容性很差,同一文件分版本

具体下载哪一个版本?

可在pythonIDE中输入

import pip;

print(pip.pep425tags.get_supported())

(pip 10没有pep425tags()这个属性,可以考虑使用,python -m pip install –upgrade pip==9.0.3回退)

查看可以获取到pip支持的文件名还有版本

在我的机器下输出

[(‘cp36’, ‘cp36m’, ‘win_amd64’), (‘cp36’, ‘none’,’win_amd64′), (‘py3’, ‘none’, ‘win_amd64’), (‘cp36’, ‘none’, ‘any’), (‘cp3′,’none’, ‘any’), (‘py36’, ‘none’, ‘any’), (‘py3’, ‘none’, ‘any’), (‘py35′,’none’, ‘any’), (‘py34’, ‘none’, ‘any’), (‘py33’, ‘none’, ‘any’), (‘py32′,’none’, ‘any’), (‘py31’, ‘none’, ‘any’), (‘py30’, ‘none’, ‘any’)]

whl文件大集合网址:https://www.lfd.uci.edu/~gohlke/pythonlibs

(注:如在上面没有找到所需的whl文件,可去该第三方库的官网下载)

假设我要下载wxPython的whl文件

于是我就下载这

wxPython-cp36-cp36mwin_amd64.whl

然后在命令行下进入whl文件所在目录,

pip install xxx.whl

2.在安装wxPython.whl的时候还发现,

[(‘cp35’, ‘none’, ‘win_amd64’), (‘py3’, ‘none’,’win_amd64′), (‘cp35’, ‘none’, ‘any’), (‘cp3’, ‘none’, ‘any’), (‘cp34’, ‘none’,’any’), (‘cp33’, ‘none’, ‘any’), (‘cp32’, ‘none’, ‘any’), (‘cp31’, ‘none’,’any’), (‘cp30’, ‘none’, ‘any’), (‘py35’, ‘none’, ‘any’), (‘py3’, ‘none’,’any’), (‘py34’, ‘none’, ‘any’), (‘py33’, ‘none’, ‘any’), (‘py32’, ‘none’,’any’), (‘py31’, ‘none’, ‘any’), (‘py30’, ‘none’, ‘any’)]

根本没有符合上述版本的wxPython.whl

因为这是pip 7,需要python -m pip install –upgradepip==9.0.3 到pip9,总而言之,pip9是最好的!!!

3.pip/python安装路径最好不要有中文,如果有的话,使用pip命令可能会显示编码错误,而python3又没有setDefaultencoding()方法,罢了罢了,不用中文

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/139387.html原文链接:https://javaforall.cn