{"id":39015,"date":"2025-07-21T15:39:53","date_gmt":"2025-07-21T07:39:53","guid":{"rendered":"https:\/\/www.applebyme.ltd\/appledb\/?p=39015"},"modified":"2025-07-21T15:39:53","modified_gmt":"2025-07-21T07:39:53","slug":"%e5%89%8d%e5%90%8e%e7%ab%af%e6%89%93%e5%8c%85%e6%88%90%e4%b8%80%e4%b8%aaexe%e6%80%8e%e4%b9%88%e5%ae%9e%e7%8e%b0%e7%9a%84%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.applebyme.ltd\/appledb\/39015\/","title":{"rendered":"\u524d\u540e\u7aef\u6253\u5305\u6210\u4e00\u4e2aexe\u600e\u4e48\u5b9e\u73b0\u7684\uff1f"},"content":{"rendered":"<p>\u524d\u540e\u7aef\u6253\u5305\u6210\u4e00\u4e2aexe\u662f\u6307\u5c06\u524d\u7aef\u548c\u540e\u7aef\u4ee3\u7801\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u53ef\u4ee5\u5728\u6ca1\u6709\u5b89\u88c5\u4efb\u4f55\u5f00\u53d1\u73af\u5883\u7684\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u3002\u8fd9\u79cd\u6253\u5305\u65b9\u5f0f\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230\u5ba2\u6237\u7aef\uff0c\u540c\u65f6\u4e5f\u4fdd\u8bc1\u4e86\u5e94\u7528\u7a0b\u5e8f\u7684\u5b89\u5168\u6027\u3002<\/p>\n<p>\u5b9e\u73b0\u524d\u540e\u7aef\u6253\u5305\u6210\u4e00\u4e2aexe\u7684\u65b9\u6cd5\u6709\u5f88\u591a\uff0c\u4e0b\u9762\u4ecb\u7ecd\u4e00\u79cd\u5e38\u7528\u7684\u65b9\u6cd5\u3002<\/p>\n<p>1. \u4f7f\u7528PyInstaller\u6253\u5305\u540e\u7aef\u4ee3\u7801<\/p>\n<p>PyInstaller\u662f\u4e00\u4e2aPython\u5e93\uff0c\u53ef\u4ee5\u5c06Python\u4ee3\u7801\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u3002\u4f7f\u7528PyInstaller\u6253\u5305\u540e\u7aef\u4ee3\u7801\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<p>\uff081\uff09\u5b89\u88c5PyInstaller<\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528pip\u5b89\u88c5PyInstaller\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>pip install pyinstaller<\/p>\n<p>&#8220;`<\/p>\n<p>\uff082\uff09\u521b\u5efaspec\u6587\u4ef6<\/p>\n<p>\u4f7f\u7528PyInstaller\u521b\u5efaspec\u6587\u4ef6\uff0cspec\u6587\u4ef6\u662f\u4e00\u4e2aPython\u811a\u672c\uff0c\u7528\u4e8e\u914d\u7f6ePyInstaller\u7684\u6253\u5305\u53c2\u6570\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efaspec\u6587\u4ef6\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>pyinstaller &#8211;name=myapp myapp.py<\/p>\n<p>&#8220;`<\/p>\n<p>\u5176\u4e2d\uff0cmyapp.py\u662f\u540e\u7aef\u4ee3\u7801\u7684\u5165\u53e3\u6587\u4ef6\uff0c&#8211;name\u53c2\u6570\u6307\u5b9a\u4e86\u6253\u5305\u540e\u7684\u53ef\u6267\u884c\u6587\u4ef6\u7684\u540d\u79f0\u3002<\/p>\n<p>\uff083\uff09\u914d\u7f6espec\u6587\u4ef6<\/p>\n<p>\u6253\u5f00\u751f\u6210\u7684spec\u6587\u4ef6\uff0c\u6839\u636e\u9700\u8981\u4fee\u6539\u5176\u4e2d\u7684\u53c2\u6570\uff0c\u6bd4\u5982\u6dfb\u52a0\u4f9d\u8d56\u5e93\u3001\u4fee\u6539\u6253\u5305\u65b9\u5f0f\u7b49\u3002<\/p>\n<p>\uff084\uff09\u6253\u5305<\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6253\u5305\u540e\u7aef\u4ee3\u7801\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>pyinstaller myapp.spec<\/p>\n<p>&#8220;`<\/p>\n<p>\u6253\u5305\u5b8c\u6210\u540e\uff0c\u4f1a\u5728dist\u76ee\u5f55\u4e0b\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p>2. \u5c06\u524d\u7aef\u4ee3\u7801\u6253\u5305\u6210\u9759\u6001\u6587\u4ef6<\/p>\n<p>\u524d\u7aef\u4ee3\u7801\u901a\u5e38\u662f\u4f7f\u7528HTML\u3001CSS\u3001JavaScript\u7b49\u6280\u672f\u7f16\u5199\u7684\uff0c\u53ef\u4ee5\u5c06\u524d\u7aef\u4ee3\u7801\u6253\u5305\u6210\u9759\u6001\u6587\u4ef6\uff0c\u7136\u540e\u5c06\u9759\u6001\u6587\u4ef6\u653e\u5728\u540e\u7aef\u4ee3\u7801\u7684\u9759\u6001\u6587\u4ef6\u76ee\u5f55\u4e0b\u3002<\/p>\n<p>\u4f7f\u7528webpack\u7b49\u5de5\u5177\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c06\u524d\u7aef\u4ee3\u7801\u6253\u5305\u6210\u9759\u6001\u6587\u4ef6\u3002\u5177\u4f53\u6b65\u9aa4\u53ef\u4ee5\u53c2\u8003webpack\u5b98\u65b9\u6587\u6863\u3002<\/p>\n<p>3. \u5c06\u524d\u7aef\u548c\u540e\u7aef\u4ee3\u7801\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6<\/p>\n<p>\u5c06\u524d\u7aef\u548c\u540e\u7aef\u4ee3\u7801\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u7684\u65b9\u6cd5\u6709\u5f88\u591a\uff0c\u8fd9\u91cc\u4ecb\u7ecd\u4e00\u79cd\u6bd4\u8f83\u7b80\u5355\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\uff081\uff09\u521b\u5efa\u4e00\u4e2a\u7a7a\u7684Python\u811a\u672c\uff0c\u6bd4\u5982main.py\u3002<\/p>\n<p>\uff082\uff09\u5728main.py\u4e2d\u8c03\u7528\u540e\u7aef\u4ee3\u7801\u7684\u5165\u53e3\u51fd\u6570\uff0c\u6bd4\u5982\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>from myapp import app<\/p>\n<p>if __name__ == &#8216;__main__&#8217;<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.yimenyun.net\/2023-03\/15\/14\/14482664084.jpg\" \/><\/figure>\n<\/p>\n<p>:<\/p>\n<p>    app.run()<\/p>\n<p>&#8220;`<\/p>\n<p>\u5176\u4e2d\uff0cmyapp\u662f\u540e\u7aef\u4ee3\u7801\u7684\u5305\u540d\uff0capp\u662f\u540e\u7aef\u4ee3\u7801\u7684Flask\u5e94\u7528\u5b9e\u4f8b\u3002<\/p>\n<p>\uff083\uff09\u5c06\u524d\u7aef\u4ee3\u7801\u6253\u5305\u6210\u9759\u6001\u6587\u4ef6\uff0c\u653e\u5728\u540e\u7aef\u4ee3\u7801\u7684\u9759\u6001\u6587\u4ef6\u76ee\u5f55\u4e0b\u3002<\/p>\n<p>\uff08<a href=\"https:\/\/exe.yimenapp.com\/tool-2048.html\">web\u7f51\u7ad9\u5c01\u88c5\u4e3aexe\u684c\u9762\u7a0b\u5e8f<\/a>4\uff09\u4f7f\u7528PyInstaller\u6253\u5305main.py\uff0c\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p>\u6253\u5305\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u5728\u6ca1\u6709\u5b89\u88c5\u4efb\u4f55\u5f00\u53d1<a href=\"https:\/\/exe.yimenapp.com\/tool-420.html\">\u5fae\u8f6f\u6253\u5305<\/a>\u73af\u5883\u7684\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u524d\u7aef\u548c\u540e\u7aef\u7684\u4ee3\u7801\u90fd\u5df2\u7ecf\u5305\u542b\u5728\u5176\u4e2d\u3002<\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u5c06\u524d\u7aef\u548c\u540e\u7aef\u4ee3\u7801\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230\u5ba2\u6237\u7aef\uff0c\u540c\u65f6\u4e5f\u4fdd\u8bc1\u4e86\u5e94\u7528\u7a0b\u5e8f\u7684\u5b89\u5168\u6027\u3002\u5b9e\u73b0\u8fd9\u79cd\u6253\u5305\u65b9\u5f0f\u7684\u65b9\u6cd5\u6709\u5f88\u591a\uff0c\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u9009\u62e9\u9002\u5408\u81ea\u5df1\u7684\u65b9\u6cd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u540e\u7aef\u6253\u5305\u6210\u4e00\u4e2aexe\u662f\u6307\u5c06\u524d\u7aef\u548c\u540e\u7aef\u4ee3\u7801\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u53ef\u4ee5\u5728\u6ca1\u6709\u5b89\u88c5\u4efb\u4f55\u5f00\u53d1\u73af\u5883\u7684\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u3002\u8fd9\u79cd\u6253\u5305\u65b9\u5f0f\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230\u5ba2\u6237\u7aef\uff0c\u540c\u65f6\u4e5f\u4fdd\u8bc1\u4e86\u5e94\u7528\u7a0b\u5e8f\u7684\u5b89\u5168\u6027\u3002\u5b9e\u73b0\u524d\u540e<\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[6736,29957,185,151,70],"topic":[],"class_list":["post-39015","post","type-post","status-publish","format-standard","hentry","category-exedb","tag-exe","tag-htmlexeie","tag-185","tag-151","tag-70"],"_links":{"self":[{"href":"https:\/\/www.applebyme.ltd\/appledb\/wp-json\/wp\/v2\/posts\/39015","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.applebyme.ltd\/appledb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.applebyme.ltd\/appledb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.applebyme.ltd\/appledb\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.applebyme.ltd\/appledb\/wp-json\/wp\/v2\/comments?post=39015"}],"version-history":[{"count":1,"href":"https:\/\/www.applebyme.ltd\/appledb\/wp-json\/wp\/v2\/posts\/39015\/revisions"}],"predecessor-version":[{"id":39026,"href":"https:\/\/www.applebyme.ltd\/appledb\/wp-json\/wp\/v2\/posts\/39015\/revisions\/39026"}],"wp:attachment":[{"href":"https:\/\/www.applebyme.ltd\/appledb\/wp-json\/wp\/v2\/media?parent=39015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.applebyme.ltd\/appledb\/wp-json\/wp\/v2\/categories?post=39015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.applebyme.ltd\/appledb\/wp-json\/wp\/v2\/tags?post=39015"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.applebyme.ltd\/appledb\/wp-json\/wp\/v2\/topic?post=39015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}