Python 技术篇-将项目打包成whl文件,whl包的制作方法

时间:2022-07-25
本文章向大家介绍Python 技术篇-将项目打包成whl文件,whl包的制作方法,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

通过pip help wheel查看wheel的命令发现:

  -w, --wheel-dir <dir>       Build wheels into <dir>, where the default is
                              the current working directory.

这就是whl的打包命令,我下了一个PyHook3的源码来进行试验,就是.tar.gz结尾的文件解压后就能看到项目源码。

C:UsersAdministrator>pip wheel -w, -wheel-dir C:UsersAdministratorDesktopP
yHook3-1.6.1
Processing c:usersadministratordesktoppyhook3-1.6.1
Building wheels for collected packages: PyHook3
  Building wheel for PyHook3 (setup.py) ... done
  Stored in directory: c:usersadministratorheel-dir
Successfully built PyHook3

什么版本的python就会生成对应版本的whl文件。

whl文件保存位置: c:usersadministratorheel-dir, 上面指明了。

想用whl打包功能,可能需要vc++运行库,如果遇到 Microsoft Visual C++ 14.0 is required 报错,

请看我的这篇文章: vc++运行库安装

运行成功图示:

PyHook3项目源码: