{"id":1881,"date":"2023-06-26T12:19:23","date_gmt":"2023-06-26T04:19:23","guid":{"rendered":"https:\/\/app.60day.cn\/appday\/?p=1881"},"modified":"2023-06-26T12:19:23","modified_gmt":"2023-06-26T04:19:23","slug":"guide%e6%89%93%e5%8c%85exe%e5%ae%9e%e7%8e%b0%e5%8e%9f%e7%90%86%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/app.60day.cn\/appday\/kaifaexe\/1881\/","title":{"rendered":"guide\u6253\u5305exe\u5b9e\u73b0\u539f\u7406\u4ecb\u7ecd"},"content":{"rendered":"<p>\u5982\u4f55\u5c06Python\u811a\u672c\u6253\u5305\u6210EXE\u6587\u4ef6\uff1a\u4e00\u4efd\u8be6\u7ec6\u6307\u5357<\/p>\n<p>\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5c06Python\u811a\u672c\u6253\u5305\u6210EXE\u6587\u4ef6\u3002\u5bf9\u4e8e\u60f3\u8981\u5c06Python\u7a0b\u5e8f\u5206\u53d1\u7ed9\u90a3\u4e9b\u53ef<a href=\"https:\/\/exe.yimenapp.com\/tool-1799.html\">exe\u6587\u4ef6\u8d852g\u6253\u5305<\/a>\u80fd\u6ca1\u6709\u5b89\u88c5Python\u73af\u5883\u7684\u7528\u6237\uff0c\u8fd9\u662f\u4e00\u4e2a\u7b80\u4fbf\u65b9\u6cd5\u3002\u6211\u4eec\u5c06\u4f7f\u7528\u4e00\u4e2a\u540d\u4e3aPyInstaller\u7684\u5de5\u5177\u6765\u5b8c\u6210\u6b64\u4efb\u52a1\u3002<\/p>\n<p>PyInstaller\u662f\u4e00\u4e2a\u8de8\u5e73\u53f0\u7684\u7b2c\u4e09\u65b9\u5e93\uff0c\u5b83\u53ef\u4ee5\u5c06Python\u7a0b\u5e8f\u6253\u5305\u6210\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u65e0\u9700\u7528\u6237\u5728\u5176\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5Python\u3002\u867d\u7136\u8fd8\u6709\u5176\u4ed6\u53ef\u4f9b\u9009\u62e9\u7684\u5e93\uff0c\u5982cx_Freeze\u3001Py2exe\u7b49\uff0c\u4f46\u6211\u4eec\u5c06\u91cd\u70b9\u4ecb\u7ecdPyInstaller\u7684\u7528\u6cd5\u3002<\/p>\n<p>\u73af\u5883\u9700\u6c42\uff1a<\/p>\n<p>1. \u5b89\u88c5Python\uff1a\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u5e76\u4e14\u5c06\u8def\u5f84\u6dfb\u52a0\u5230\u4e86\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u5982\u679c\u4f60\u6ca1\u6709\u5b89\u88c5Python\uff0c\u53ef\u4ee5\u5728\u5b98\u65b9\u7f51\u7ad9https:\/\/www.python.org\/downloads\/ \u4e0a\u4e0b\u8f7d\u5b89\u88c5\u3002<\/p>\n<p>2. Python\u811a\u672c\uff1a\u4e00\u4e2a\u4f60\u60f3\u8981\u8f6c\u6362\u4e3aEXE\u6587\u4ef6\u7684Python\u811a\u672c\u3002<\/p>\n<p>3. \u7f16\u8f91\u5668\uff1a\u4efb\u4f55\u6587\u672c\u7f16\u8f91\u5668\uff0c\u4f8b\u5982VS Code\u3001Atom\u3001Notepad ++\u7b49\u3002<\/p>\n<p>\u6b65\u9aa41\uff1a\u5b89\u88c5PyInstaller<\/p>\n<p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u5b89\u88c5PyInstaller\u3002\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>&#8220;`bash<\/p>\n<p>pip install pyinstaller<\/p>\n<p>&#8220;`<\/p>\n<p>\u7b49\u5f85\u5b89\u88c5\u5b8c\u6210\u3002<\/p>\n<p>\u6b65\u9aa42<a href=\"https:\/\/exe.yimenapp.com\/tool-2199.html\">\u5982\u4f55\u5c01\u88c5\u591a\u4e2a\u6587\u4ef6\u6210\u4e3aexe<\/a>\uff1a\u5bfc\u822a\u5230Python\u811a\u672c\u7684\u76ee\u5f55<\/p>\n<p>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u4e2d\uff0c\u5bfc\u822a\u5230\u5305\u542bPython\u811a\u672c\u7684\u76ee\u5f55\u3002\u4f8b\u5982\uff0c\u5047\u8bbe\u811a\u672c\u4f4d\u4e8e&#8221;C:\\Users\\xyz\\Documents\\python_scripts&#8221;\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c06\u5f53\u524d\u76ee\u5f55\u66f4\u6539\u4e3a\u8be5\u76ee\u5f55\uff1a<\/p>\n<p>&#8220;`bash<\/p>\n<p>cd C:\\Users\\xyz\\Documents\\python_scripts<\/p>\n<p>&#8220;`<\/p>\n<p>\u6b65\u9aa43\uff1a\u4f7f\u7528PyInstaller\u6253\u5305Python\u811a\u672c<\/p>\n<p>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u4e2d\u952e\u5165\u4ee5\u4e0b\u547d\u4ee4\uff0c\u5176\u4e2d\u201cexample_script.py\u201d\u662f\u8981\u6253\u5305\u7684Python\u811a\u672c\uff1a<\/p>\n<p>&#8220;`bash<\/p>\n<p>pyinstaller &#8211;onefile example_script.py<\/p>\n<p>&#8220;`<\/p>\n<p>\u901a\u8fc7\u4f7f\u7528`&#8211;onefile`\u9009\u9879\uff0c\u6211\u4eec\u544a\u8bc9PyInstaller\u5c06\u6240\u6709\u4f9d\u8d56\u9879\u90fd\u6253\u5305\u5230\u4e00\u4e2a\u5355\u72ec\u7684EXE\u6587\u4ef6\u4e2d\u3002PyInstaller\u5c06\u5f00\u59cb\u6267\u884c\u6253\u5305\u8fc7\u7a0b\uff0c\u5305\u62ec\u5206\u6790\u811a\u672c\u3001\u6536\u96c6\u6240\u6709\u5fc5\u9700\u7684\u4f9d\u8d56\u9879\u5e93\u548c\u5c06\u5176\u6253\u5305\u4e3a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p>\u6253\u5305\u5b8c\u6210\u540e\uff0c\u4f60\u4f1a\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u770b\u5230\u4e00\u4e2a\u540d\u4e3a\u201cdist\u201d\u7684\u6587\u4ef6\u5939\u3002\u8f6c\u5230\u8be5\u6587\u4ef6\u5939\uff0c\u4f60\u4f1a\u627e\u5230\u6700\u7ec8\u7684EXE\u6587\u4ef6\u3002\u6267\u884c\u6b64\u6587\u4ef6\uff0c\u5b83\u5c06\u8fd0\u884c\u4f60\u7684Python\u811a\u672c\u3002<\/p>\n<p>\u60a8\u8fd8\u53ef\u4ee5\u5c1d\u8bd5\u5176\u4ed6\u9009\u9879\uff0c\u4f8b\u5982\uff1a<\/p>\n<p>&#8211; \u66f4\u6539\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\u7684\u56fe\u6807\uff1a<\/p>\n<p>&#8220;`bash<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/14\/15\/12026363138.jpg\" \/><\/figure>\n<\/p>\n<p>pyinstaller &#8211;onefile &#8211;icon=myicon.ico example_script.py<\/p>\n<p>&#8220;`<\/p>\n<p>&#8211; \u4e3a\u6267\u884c\u6027\u80fd\u4fdd\u7559Python\u5b57\u8282\u7801\uff1a<\/p>\n<p>&#8220;`bash<\/p>\n<p>pyinstaller &#8211;onefile &#8211;noupx example_script.py<\/p>\n<p>&#8220;`<\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u5728\u672c\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528PyInstaller\u5c06Python\u811a\u672c\u6253\u5305\u6210EXE\u6587\u4ef6\u3002\u8fd9\u975e\u5e38\u9002\u5408\u5c06Python\u7a0b\u5e8f\u5206\u53d1\u7ed9\u672a\u5b89\u88c5Python\u7684\u7528\u6237\u3002+ \u5c1d\u8bd5\u4e3a\u4f60\u7684Python\u811a\u672c\u521b\u5efa\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5e76\u4e0e\u4ed6\u4eba\u5206\u4eab\uff01\u5982\u679c\u4f60\u9047\u5230\u4efb\u4f55\u95ee\u9898\uff0c\u8bf7\u5728\u8bc4\u8bba\u4e2d\u63d0\u95ee\u3002\u6211\u4eec\u5c06\u5c3d\u529b\u89e3\u51b3\u60a8\u7684\u95ee\u9898\u3002\u7f16\u5199\u5e72\u51c0\u3001\u53ef\u7ef4\u62a4\u7684Python\u4ee3\u7801\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u5c06Python\u811a\u672c\u6253\u5305\u6210EXE\u6587\u4ef6\uff1a\u4e00\u4efd\u8be6\u7ec6\u6307\u5357\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5c06Python\u811a\u672c\u6253\u5305\u6210EXE\u6587\u4ef6\u3002\u5bf9\u4e8e\u60f3\u8981\u5c06Python\u7a0b\u5e8f\u5206\u53d1\u7ed9\u90a3\u4e9b\u53ef\u80fd\u6ca1\u6709\u5b89\u88c5Python\u73af\u5883\u7684\u7528\u6237\uff0c\u8fd9\u662f\u4e00<\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[4019,132,4020,180,694],"topic":[],"class_list":["post-1881","post","type-post","status-publish","format-standard","hentry","category-kaifaexe","tag-winformexe","tag-132","tag-exe","tag-180","tag-694"],"_links":{"self":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts\/1881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/comments?post=1881"}],"version-history":[{"count":0,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts\/1881\/revisions"}],"wp:attachment":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/media?parent=1881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/categories?post=1881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/tags?post=1881"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/topic?post=1881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}