How to edit a wheel package (.whl)?

孤街醉人 提交于 2021-02-19 01:34:27

问题


I have a python wheel package, when extracted I find some python code, I'd like to edit this code and re-generate the same .whl package again and test it to see the edits .. How do I do that?


回答1:


You usually don't.

Normally you get the source package instead of the wheel (or use development mode to install the package in editable form) and rebuild the wheel from that, e.g. by running python setup.py bdist_wheel.

Have a look at https://packaging.python.org/distributing/ for a lot of information how to build those wheel packages.




回答2:


Wheel provides the wheel command in addition to just setup.py bdist_wheel. Use wheel unpack [file.whl] to open the wheel, edit what you will, and then use wheel pack [directory] to put it back together again.




回答3:


you can open the whl file using 7zip or something alike, track the file you wish to change, open in edit mode, save it, next 7zip will popup a message saying something was modified and if you want the change to be saved, press yes and youre good to go.

remember to backup your original whl before doing it..



来源:https://stackoverflow.com/questions/41898424/how-to-edit-a-wheel-package-whl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!