日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無(wú)先后,達(dá)者為師

網(wǎng)站首頁(yè) 編程語(yǔ)言 正文

python學(xué)習(xí)之whl文件解釋與安裝詳解_python

作者:L-M-Y ? 更新時(shí)間: 2022-11-13 編程語(yǔ)言

.whl文件解釋

whl文件時(shí)以wheel格式保存的python安裝包,Wheel是Python發(fā)行版的標(biāo)準(zhǔn)內(nèi)置包格式。WHL文件包含Python安裝的所有文件和元數(shù)據(jù),其中還包括所使用的Wheel版本和打包的規(guī)范。WHL文件使用Zip壓縮進(jìn)行壓縮,實(shí)際上也是一種壓縮文件

目前wheel被認(rèn)為是python的二進(jìn)制包的標(biāo)準(zhǔn)格式。

說(shuō)白了,.whl就是python的壓縮包

舉個(gè)栗子:

rknn_toolkit-1.7.1-cp36-cp36m-win_amd64.whl

其中,rknn_toolkit是文件名,cp36指的是對(duì)應(yīng)的python版本,cp36就是python3.6,同理,cp37就是python3.7,win指操作系統(tǒng)為windows,amd指64位

whl文件的安裝格式:

pip install 文件名.whl

一些報(bào)錯(cuò)的說(shuō)明

1.file does not exist

這時(shí),你需要把終端的文件位置切換為你保存.whl文件的地址

比如我的文件地址:

2..whl is not a supported wheel on this platform.

這代表你當(dāng)前的python版本和.whl文件的python版本不一致,此時(shí)切換環(huán)境即可

成功安裝頁(yè)面

補(bǔ)充:whl文件安裝失敗解決方法

在cmd命令行下安裝whl文件:

pip install ***.whl

***是文件名,也可以是路徑+文件名

報(bào)錯(cuò):***.whl is not a supported wheel on this platform.

原因一:文件和python不匹配(文件名中cm后面的數(shù)字和python版本應(yīng)該匹配)

查看python版本(Shell):

ADM64

import pip._internal
print(pip._internal.pep425tags.get_supported())

WIN32

import pip
print(pip.pep425tags.get_supported())

如果輸入不對(duì)會(huì)出現(xiàn):AttributeError: module 'pip' has no attribute 'pep425tags'

輸入成功可進(jìn)入python目錄,查看支持的版本

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pip._internal
>>> print(pip._internal.pep425tags.get_supported())
[('cp37', 'cp37m', 'win_amd64'), ('cp37', 'none', 'win_amd64'), ('py3', 'none', 'win_amd64'), ('cp37', 'none', 'any'), ('cp3', 'none', 'any'), ('py37', 'none', 'any'), ('py3', 'none', 'any'), ('py36', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')]
>>> 

下載對(duì)應(yīng)版本,安裝whl文件

二、如果版本沒(méi)有錯(cuò),那就是wheel沒(méi)有安裝

在cmd命令窗口輸入:pip install wheel

提示Successful后安裝成功,在找到whl文件安裝

總結(jié)

原文鏈接:https://blog.csdn.net/qq_52109814/article/details/124354299

欄目分類(lèi)
最近更新