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

學無先后,達者為師

網站首頁 編程語言 正文

python學習之whl文件解釋與安裝詳解_python

作者:L-M-Y ? 更新時間: 2022-11-13 編程語言

.whl文件解釋

whl文件時以wheel格式保存的python安裝包,Wheel是Python發行版的標準內置包格式。WHL文件包含Python安裝的所有文件和元數據,其中還包括所使用的Wheel版本和打包的規范。WHL文件使用Zip壓縮進行壓縮,實際上也是一種壓縮文件

目前wheel被認為是python的二進制包的標準格式。

說白了,.whl就是python的壓縮包

舉個栗子:

rknn_toolkit-1.7.1-cp36-cp36m-win_amd64.whl

其中,rknn_toolkit是文件名,cp36指的是對應的python版本,cp36就是python3.6,同理,cp37就是python3.7,win指操作系統為windows,amd指64位

whl文件的安裝格式:

pip install 文件名.whl

一些報錯的說明

1.file does not exist

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

比如我的文件地址:

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

這代表你當前的python版本和.whl文件的python版本不一致,此時切換環境即可

成功安裝頁面

補充:whl文件安裝失敗解決方法

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

pip install ***.whl

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

報錯:***.whl is not a supported wheel on this platform.

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

查看python版本(Shell):

ADM64

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

WIN32

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

如果輸入不對會出現:AttributeError: module 'pip' has no attribute 'pep425tags'

輸入成功可進入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')]
>>> 

下載對應版本,安裝whl文件

二、如果版本沒有錯,那就是wheel沒有安裝

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

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

總結

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

欄目分類
最近更新