python生成whl

whl是我们安装python三方库时离线下载的一个文件,用pip install xxx.whl即可安装

可是有些三方库download时只有tar包文件,没有whl文件

比如:pymsgbox

 

 如何生成我们想要的whl文件?

我们下载这个tar包并解压,目录如下:

运行python setup.py bdist_wheel即可生成whl文件

 

 进入到dist里运行pip install xxx.whl,这个三方库就会离线安装成功

 但这样也有个缺陷,就是我们离线安装的这个库可能会有写依赖包没有被安装,只有联网安装时依赖包才会被自动安装.

ERROR: pip's legacy dependency resolver does not consider dependency conflicts when selecting packages. This behaviour is the source of the following dependency conflicts.
pyautogui 0.9.53 requires mouseinfo, which is not installed.
pyautogui 0.9.53 requires pygetwindow>=0.0.5, which is not installed.
pyautogui 0.9.53 requires pyscreeze>=0.1.21, which is not installed.
pyautogui 0.9.53 requires pytweening>=1.0.4, which is not installed.

posted @ 2023-03-07 09:23  腹肌猿  阅读(756)  评论(0编辑  收藏  举报