python学习之whl文件解释与安装详解

 

.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文件安装

 

总结

关于python学习之whl文件解释与安装的文章就介绍至此,更多相关python whl文件解释安装内容请搜索编程宝库以前的文章,希望以后支持编程宝库

 一、事务操作模块 from django.db import transaction1 开启事务:with transaction.atomic()from django.db i ...