{"id":43822,"date":"2025-07-08T15:40:00","date_gmt":"2025-07-08T07:40:00","guid":{"rendered":"https:\/\/h5app.yimenapp.cn\/h5app\/?p=43822"},"modified":"2025-07-08T15:40:00","modified_gmt":"2025-07-08T07:40:00","slug":"%e5%88%b6%e4%bd%9c%e7%8b%ac%e7%ab%8bexe%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\/2025\/ruanjiankf\/43822\/","title":{"rendered":"\u5236\u4f5c\u72ec\u7acbexe\u64cd\u4f5c\u529e\u6cd5\u4ecb\u7ecd"},"content":{"rendered":"<p>\u5236\u4f5c\u72ec\u7acbexe\u662f\u6307\u5c06\u4e00\u4e2a\u7a0b\u5e8f\u6253\u5305\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u4f7f\u5f97\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u8be5\u6587\u4ef6\uff0c\u800c\u4e0d\u9700\u8981\u5b89\u88c5\u4efb\u4f55\u5176\u4ed6\u4f9d\u8d56\u3002\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u65b9\u4fbf\u7528\u6237\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u4fdd\u62a4\u7a0b\u5e8f\u7684\u77e5\u8bc6\u4ea7\u6743\u3002\u4e0b\u9762\u4ecb\u7ecd\u51e0\u79cd\u5236\u4f5c\u72ec\u7acbexe\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u4e00\u3001\u4f7f\u7528pyinstaller<\/p>\n<p>pyinstaller\u662f\u4e00\u4e2aPython\u7b2c\u4e09\u65b9\u5e93\uff0c\u53ef\u4ee5\u5c06Python\u7a0b\u5e8f\u6253\u5305\u6210\u72ec\u7acb\u7684exe\u6587\u4ef6\u3002\u4f7f\u7528pyinstaller\u5236\u4f5c\u72ec\u7acbexe\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<p>1. \u5b89\u88c5pyinstaller\u5e93\uff1a\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u201cpip install pyinstaller\u201d\u5373\u53ef\u5b89\u88c5\u3002<\/p>\n<p>2. \u6253\u5305\u7a0b\u5e8f\uff1a\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u201cpyinstaller -F your_program.py\u201d\u5373\u53ef\u5c06your_program.py\u6587\u4ef6\u6253\u5305\u6210\u72ec\u7acbexe\u6587\u4ef6\u3002<\/p>\n<p>3. \u67e5\u770bexe\u6587\u4ef6\uff1a\u6253\u5305\u6210\u529f\u540e\uff0c\u53ef\u5728dist\u76ee\u5f55\u4e0b\u627e\u5230\u751f\u6210\u7684exe\u6587\u4ef6\u3002<\/p>\n<p>\u4e8c\u3001\u4f7f\u7528py2exe<\/p>\n<p>py2exe\u662f\u53e6\u4e00\u4e2a\u5c06Python\u7a0b\u5e8f\u6253\u5305\u6210\u72ec\u7acbexe\u6587\u4ef6\u7684\u5de5\u5177\uff0c\u4f7f\u7528\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p>1. \u5b89\u88c5py2exe\uff1a\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u201cpip install py2<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.yimenyun.net\/2023-03\/14\/14\/34425950374.jpg\" \/><\/figure>\n<\/p>\n<p>exe\u201d\u5373\u53ef\u5b89\u88c5\u3002<\/p>\n<p>2. \u521b\u5efasetup.py\u6587\u4ef6\uff1a\u5728\u7a0b\u5e8f\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2asetup.py\u6587\u4ef6\uff0c\u6587\u4ef6\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>from distutils.core import setup<\/p>\n<p>import py2exe<\/p>\n<p>setup(cons<a href=\"https:\/\/exe.yimenapp.com\/tool-2790.html\">win10\u684c\u9762\u5f00\u53d1<\/a>ole=[&#8216;your_program.py&#8217;])<\/p>\n<p>&#8220;`<\/p>\n<p>3. \u6253\u5305\u7a0b\u5e8f\uff1a\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u201cpython setup.py py2exe\u201d\u5373\u53ef\u5c06\u7a0b\u5e8f\u6253\u5305\u6210\u72ec\u7acbexe\u6587\u4ef6\u3002<\/p>\n<p>4. \u67e5\u770bexe\u6587\u4ef6\uff1a\u6253\u5305\u6210\u529f\u540e\uff0c\u53ef\u5728dist\u76ee\u5f55\u4e0b\u627e\u5230\u751f\u6210\u7684exe\u6587\u4ef6\u3002<\/p>\n<p>\u4e09\u3001\u4f7f\u7528cx_Freeze<\/p>\n<p>cx_Freeze\u662f\u53e6\u4e00\u4e2a\u5c06Python\u7a0b\u5e8f\u6253\u5305\u6210\u72ec\u7acbexe\u6587\u4ef6\u7684\u5de5\u5177\uff0c\u4f7f\u7528\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p>1. \u5b89\u88c5cx_Freeze\uff1a\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u201cpip install cx_Freeze\u201d\u5373\u53ef\u5b89\u88c5\u3002<\/p>\n<p>2. \u521b\u5efasetup.py\u6587\u4ef6\uff1a\u5728\u7a0b\u5e8f\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2asetup.py\u6587\u4ef6\uff0c\u6587\u4ef6\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>import sys<\/p>\n<p>from cx_Freeze import setup, Executable<\/p>\n<p>build_exe_options = {&#8220;packages&#8221;: [&#8220;os&#8221;], &#8220;excludes&#8221;: [&#8220;tkinter&#8221;]}<\/p>\n<p>setup(<\/p>\n<p>    name = &#8220;your_program_name&#8221;,<\/p>\n<p>    version = &#8220;1.0&#8221;,<\/p>\n<p>    description = &#8220;your_program_description&#8221;,<\/p>\n<p>    options = {&#8220;build_exe&#8221;: build_exe_options},<\/p>\n<p>    executables = [Executable(&#8220;your_program.py&#8221;, base=None)]<\/p>\n<p>)<\/p>\n<p>&#8220;`<\/p>\n<p>3. \u6253\u5305\u7a0b\u5e8f\uff1a\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u201cpython setup.py<a href=\"https:\/\/exe.yimenapp.com\/tool-3614.html\">php\u751f\u6210\u8f6f\u4ef6<\/a> build\u201d\u5373\u53ef\u5c06\u7a0b\u5e8f\u6253\u5305\u6210\u72ec\u7acbexe\u6587\u4ef6\u3002<\/p>\n<p>4. \u67e5\u770bexe\u6587\u4ef6\uff1a\u6253\u5305\u6210\u529f\u540e\uff0c\u53ef\u5728build\u76ee\u5f55\u4e0b\u627e\u5230\u751f\u6210\u7684exe\u6587\u4ef6\u3002<\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u4ee5\u4e0a\u4e09\u79cd\u65b9\u6cd5\u90fd\u53ef\u4ee5\u5c06Python\u7a0b\u5e8f\u6253\u5305\u6210\u72ec\u7acbexe\u6587\u4ef6\uff0c\u4f7f\u7528\u8d77\u6765\u4e5f\u6bd4\u8f83\u7b80\u5355\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd8\u6709\u5176\u4ed6\u5de5\u5177\u53ef\u4ee5\u5c06\u7a0b\u5e8f\u6253\u5305\u6210exe\u6587\u4ef6\uff0c\u5982py2app\u3001pyinstaller\u7b49\u3002\u4f46\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6253\u5305\u6210\u72ec\u7acbexe\u6587\u4ef6\u65f6\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u4e00\u4e9b\u4f9d\u8d56\u95ee\u9898\uff0c\u9700\u8981\u5728\u6253\u5305\u524d\u8fdb\u884c\u4e00\u4e9b\u914d\u7f6e\u3002\u540c\u65f6\uff0c\u6253\u5305\u540e\u7684exe\u6587\u4ef6\u4e5f\u53ef\u80fd\u4f1a\u88ab\u6740\u6bd2\u8f6f\u4ef6\u8bef\u62a5\uff0c\u56e0\u6b64\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u9632\u8bef\u62a5\u7684\u5904\u7406\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5236\u4f5c\u72ec\u7acbexe\u662f\u6307\u5c06\u4e00\u4e2a\u7a0b\u5e8f\u6253\u5305\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u4f7f\u5f97\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u8be5\u6587\u4ef6\uff0c\u800c\u4e0d\u9700\u8981\u5b89\u88c5\u4efb\u4f55\u5176\u4ed6\u4f9d\u8d56\u3002\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u65b9\u4fbf\u7528\u6237\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u4fdd\u62a4\u7a0b\u5e8f\u7684\u77e5\u8bc6\u4ea7\u6743\u3002\u4e0b\u9762\u4ecb\u7ecd\u51e0\u79cd\u5236\u4f5c\u72ec\u7acbexe\u7684\u65b9\u6cd5\u3002\u4e00<\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[1419,1405,81,179,34080],"topic":[],"class_list":["post-43822","post","type-post","status-publish","format-standard","hentry","category-ruanjiankf","tag-windowsdeb","tag-1405","tag-81","tag-179","tag-34080"],"_links":{"self":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/43822","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\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/comments?post=43822"}],"version-history":[{"count":1,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/43822\/revisions"}],"predecessor-version":[{"id":43825,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/43822\/revisions\/43825"}],"wp:attachment":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/media?parent=43822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/categories?post=43822"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/tags?post=43822"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/topic?post=43822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}