{"id":47089,"date":"2026-01-30T12:17:37","date_gmt":"2026-01-30T04:17:37","guid":{"rendered":"https:\/\/h5app.yimenapp.cn\/h5app\/?p=47089"},"modified":"2026-01-30T12:17:37","modified_gmt":"2026-01-30T04:17:37","slug":"j%e7%94%9f%e6%88%90exe%e6%96%87%e4%bb%b6%e6%93%8d%e4%bd%9c%e5%8a%9e%e6%b3%95%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/h5app.yimenapp.cn\/h5app\/2026\/ruanjiankf\/47089\/","title":{"rendered":"j\u751f\u6210exe\u6587\u4ef6\u64cd\u4f5c\u529e\u6cd5\u4ecb\u7ecd"},"content":{"rendered":"<p>\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u5c06\u5411\u60a8\u4ecb\u7ecd\u5982\u4f55\u5c06\u4e00\u4e2a\u7b80\u5355\u7684Python\u7a0b\u5e8f\u8f6c\u6362\u4e3a\u4e00\u4e2a\u53ef\u6267\u884c\u7684exe\u6587\u4ef6\u3002\u8fd9\u91cc\uff0c\u6211\u4eec\u5c06\u91cd\u70b9\u4ecb\u7ecd\u539f\u7406\u4ee5\u53ca\u6240\u6d89\u53ca\u7684\u57fa\u672c\u6b65\u9aa4\u3002\u5728\u672c\u6559\u7a0b\u7684\u6700\u540e\uff0c\u60a8\u5c06\u4e86\u89e3\u4e3a\u4ec0\u4e48\u8f6c\u6362Python\u811a\u672c\u5230exe\u6587\u4ef6\u53ef\u80fd\u662f\u6709\u7528\u7684\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528PyInstaller\u5de5\u5177\u6765\u5b8c\u6210\u8fd9\u4e2a\u4efb\u52a1\u3002<\/p>\n<p>\u539f\u7406\uff1a<\/p>\n<p>\u5c06Python\u811a\u672c\uff08.py\u6587\u4ef6\uff09\u8f6c\u6362\u4e3aexe\u6587\u4ef6\u7684\u4e3b\u8981\u539f\u56e0\u662f\u65b9\u4fbf\u5728\u6ca1\u6709\u5b89\u88c5Python\u89e3\u91ca\u5668\u7684\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884cPython\u7a0b\u5e8f\u3002\u5f53\u60a8\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3aexe\u6587\u4ef6\u65f6\uff0c\u60a8\u5b9e\u9645\u4e0a\u662f\u5c06Python\u89e3\u91ca\u5668\u548c\u811a\u672c\u6253\u5305\u5230\u4e00\u4e2a\u5355\u72ec\u7684\u53ef\u6267\u884c\u6587\u4ef6\u4e2d\u3002\u8fd9\u6837\uff0c\u5f53\u7528\u6237\u8fd0\u884c\u6b64exe\u6587\u4ef6\u65f6\uff0c\u5b83\u5c06\u542f\u52a8\u5185\u7f6e\u7684Python\u89e3\u91ca\u5668\u6765\u6267\u884c\u811a\u672c\uff0c\u800c\u65e0\u9700\u7528\u6237\u81ea\u5df1\u5b89\u88c5Python\u3002<\/p>\n<p>\u8be6\u7ec6\u4ecb\u7ecd\uff1a<\/p>\n<p>\u4e3a\u4e86\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3aexe\u6587\u4ef6\uff0c\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u540d\u4e3a<a href=\"https:\/\/www.yimenexe.com\/ruanjian-kaifa-33.html\">flash\u751f\u6210\u7684exe\u6587\u4ef6<\/a>PyInstaller\u7684\u7b2c\u4e09\u65b9\u5e93\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528pip\u547d\u4ee4\u8f7b\u677e\u5730\u5b89\u88c5PyInstaller\uff1a<\/p>\n<p>&#8220;`bash<\/p>\n<p>pip install pyinstaller<\/p>\n<p>&#8220;`<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u8fdb\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p>1. \u521b\u5efa\u4e00\u4e2a\u7b80\u5355<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.yimenyun.net\/2023-03\/22\/10\/29123255165.jpg\" \/><\/figure>\n<\/p>\n<p>\u7684Python\u811a\u672c\uff08\u4f8b\u5982\uff1aexample.py\uff09\uff0c\u5e76\u786e\u4fdd\u8fd9\u4e2a\u811a\u672c\u80fd\u5728\u60a8\u7684\u7cfb\u7edf\u4e0a\u987a\u5229\u8fd0\u884c\u3002<\/p>\n<p>example.py \u7684\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<p>&#8220;`python<\/p>\n<p>print(&#8220;Hello, world!&#8221;)<\/p>\n<p>input(&#8220;\\nPress Enter to exit.&#8221;)<\/p>\n<p>&#8220;`<\/p>\n<p>2. \u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08Windows\uff09\u6216\u7ec8\u7aef\uff08Mac\u548cLinux\uff09\uff0c\u5e76\u8fdb\u5165\u5230example.py\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\u3002<\/p>\n<p>3. \u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u884c\uff0c\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3aexe\u6587\u4ef6\uff1a<\/p>\n<p>&#8220;`bash<\/p>\n<p>pyinstaller &#8211;onefile example.py<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u544a\u8bc9PyInstaller<a href=\"https:\/\/www.yimenexe.com\/exe-kaifa-2046.html\">\u7f51\u5427\u5de5\u5177\u7bb1exe<\/a>\u4ee5\u4e00\u4f53\u5316\u6a21\u5f0f\uff08\u6307\u5c06\u6240\u6709\u5185\u5bb9\u6253\u5305\u5230\u4e00\u4e2aexe\u6587\u4ef6\u4e2d\uff09\u8fdb\u884c\u64cd\u4f5c\uff0c\u5e76\u5c06example.py\u6587\u4ef6\u4f5c\u4e3a\u8f93\u5165\u3002<\/p>\n<p>4. PyInstaller\u5c06\u5f00\u59cb\u5904\u7406\u60a8\u7684\u811a\u672c\uff0c\u5e76\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u751f\u6210\u4e00\u4e2a\u540d\u4e3a`dist`\u7684\u65b0\u6587\u4ef6\u5939\u3002\u5f53\u8f6c\u6362\u8fc7\u7a0b\u5b8c\u6210\u540e\uff0c\u5728`dist`\u6587\u4ef6\u5939\u4e2d\uff0c\u60a8\u5c06\u627e\u5230\u4e00\u4e2a\u540d\u4e3a`example.exe`\u7684\u6587\u4ef6\uff0c\u60a8\u53ef\u4ee5\u5728\u6ca1\u6709\u5b89\u88c5Python\u89e3\u91ca\u5668\u7684\u8ba1\u7b97\u673a\u4e0a\u76f4\u63a5\u8fd0\u884c\u8fd9\u4e2a\u6587\u4ef6\u3002<\/p>\n<p>\u6ce8\u610f\uff1a\u8f6c\u6362\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u60a8\u7684\u811a\u672c\u5927\u5c0f\u4ee5\u53ca\u5176\u4ed6\u76f8\u5173\u56e0\u7d20\u3002<\/p>\n<p>\u603b\u7ed3\uff1a<\/p>\n<p>\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u60a8\u5df2\u7ecf\u5b66\u4f1a\u4e86\u5982\u4f55\u5c06\u4e00\u4e2a\u7b80\u5355\u7684Python\u811a\u672c\u8f6c\u6362\u4e3aexe\u6587\u4ef6\u3002\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3aexe\u6587\u4ef6\u7684\u8fc7\u7a0b\u6d89\u53ca\u5230\u4f7f\u7528PyInstaller\u5e93\u5c06Python\u89e3\u91ca\u5668\u53ca\u5176\u4f9d\u8d56\u9879\u6253\u5305\u5230\u4e00\u4e2a\u5355\u72ec\u7684\u53ef\u6267\u884c\u6587\u4ef6\u4e2d\u3002\u8fd9\u4f7f\u60a8\u7684Python\u7a0b\u5e8f\u80fd\u5728\u6ca1\u6709\u5b89\u88c5Python\u89e3\u91ca\u5668\u7684\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\uff0c\u4e3a\u5206\u53d1\u548c\u90e8\u7f72\u63d0\u4f9b\u4e86\u66f4\u7b80\u4fbf\u7684\u65b9\u5f0f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u5c06\u5411\u60a8\u4ecb\u7ecd\u5982\u4f55\u5c06\u4e00\u4e2a\u7b80\u5355\u7684Python\u7a0b\u5e8f\u8f6c\u6362\u4e3a\u4e00\u4e2a\u53ef\u6267\u884c\u7684exe\u6587\u4ef6\u3002\u8fd9\u91cc\uff0c\u6211\u4eec\u5c06\u91cd\u70b9\u4ecb\u7ecd\u539f\u7406\u4ee5\u53ca\u6240\u6d89\u53ca\u7684\u57fa\u672c\u6b65\u9aa4\u3002\u5728\u672c\u6559\u7a0b\u7684\u6700\u540e\uff0c\u60a8\u5c06\u4e86\u89e3\u4e3a\u4ec0\u4e48\u8f6c\u6362Python\u811a\u672c\u5230exe\u6587\u4ef6\u53ef\u80fd<\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[35878,35879,81,507,232],"topic":[],"class_list":["post-47089","post","type-post","status-publish","format-standard","hentry","category-ruanjiankf","tag-exe","tag--exe","tag-81","tag-507","tag-232"],"_links":{"self":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/47089","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/comments?post=47089"}],"version-history":[{"count":1,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/47089\/revisions"}],"predecessor-version":[{"id":47102,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/47089\/revisions\/47102"}],"wp:attachment":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/media?parent=47089"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/categories?post=47089"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/tags?post=47089"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/topic?post=47089"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}