{"id":932094,"date":"2024-12-26T17:51:47","date_gmt":"2024-12-26T09:51:47","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/932094.html"},"modified":"2024-12-26T17:51:49","modified_gmt":"2024-12-26T09:51:49","slug":"python%e5%a6%82%e4%bd%95build-exe","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/932094.html","title":{"rendered":"python\u5982\u4f55build exe"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25070113\/eec6c184-9c04-4468-b755-4f3c4d717d17.webp\" alt=\"python\u5982\u4f55build exe\" \/><\/p>\n<p><p> <strong>\u8981\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\uff08EXE\uff09\uff0c\u53ef\u4ee5\u4f7f\u7528\u5de5\u5177\u5982PyInstaller\u3001cx_Freeze\u3001Py2exe\u7b49\u3002PyInstaller\u662f\u4e00\u4e2a\u6d41\u884c\u4e14\u6613\u4e8e\u4f7f\u7528\u7684\u9009\u9879\uff0c\u5b83\u53ef\u4ee5\u5c06Python\u811a\u672c\u6253\u5305\u4e3a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u4f7f\u5176\u5728\u6ca1\u6709Python\u73af\u5883\u7684\u673a\u5668\u4e0a\u8fd0\u884c\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528PyInstaller\u7684\u57fa\u672c\u6b65\u9aa4\uff1a\u5b89\u88c5PyInstaller\u3001\u7f16\u5199Python\u811a\u672c\u3001\u4f7f\u7528PyInstaller\u547d\u4ee4\u884c\u5de5\u5177\u6253\u5305\u811a\u672c\u3002<\/strong><\/p>\n<\/p>\n<p><p>\u4e00\u3001\u5b89\u88c5PyInstaller<\/p>\n<\/p>\n<p><p>\u5728\u5f00\u59cb\u4f7f\u7528PyInstaller\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u548cpip\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5PyInstaller\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pyinstaller<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u4e0b\u8f7d\u5e76\u5b89\u88c5PyInstaller\u7684\u6700\u65b0\u7248\u672c\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u7f16\u5199Python\u811a\u672c<\/p>\n<\/p>\n<p><p>\u5728\u4f7f\u7528PyInstaller\u4e4b\u524d\uff0c\u9700\u8981\u5148\u7f16\u5199\u4e00\u4e2aPython\u811a\u672c\u3002\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u7b80\u5355\u7684Python\u811a\u672c<code>hello.py<\/code>\uff0c\u5176\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello, World!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u7b80\u5355\u7684\u811a\u672c\uff0c\u4f46\u5b83\u8db3\u4ee5\u7528\u4e8e\u6f14\u793a\u5c06\u5176\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u4f7f\u7528PyInstaller\u6253\u5305Python\u811a\u672c<\/p>\n<\/p>\n<p><p>\u4e00\u65e6PyInstaller\u5b89\u88c5\u5b8c\u6bd5\u5e76\u4e14Python\u811a\u672c\u51c6\u5907\u5c31\u7eea\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528PyInstaller\u5c06\u811a\u672c\u6253\u5305\u4e3aEXE\u6587\u4ef6\u3002\u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u5bfc\u822a\u5230Python\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\uff0c\u7136\u540e\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u547d\u4ee4\u544a\u8bc9PyInstaller\u5c06<code>hello.py<\/code>\u6253\u5305\u4e3a\u4e00\u4e2a\u5355\u72ec\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<code>--onefile<\/code>\u9009\u9879\u6307\u5b9aPyInstaller\u751f\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u800c\u4e0d\u662f\u751f\u6210\u4e00\u4e2a\u5305\u542b\u591a\u4e2a\u6587\u4ef6\u7684\u6587\u4ef6\u5939\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u7406\u89e3PyInstaller\u751f\u6210\u7684\u6587\u4ef6\u7ed3\u6784<\/p>\n<\/p>\n<p><p>\u8fd0\u884c\u4e0a\u8ff0\u547d\u4ee4\u540e\uff0cPyInstaller\u5c06\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u521b\u5efa\u51e0\u4e2a\u65b0\u7684\u6587\u4ef6\u548c\u6587\u4ef6\u5939\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>build\u6587\u4ef6\u5939<\/strong>\uff1a\u7528\u4e8e\u5b58\u653e\u6784\u5efa\u8fc7\u7a0b\u4e2d\u751f\u6210\u7684\u4e34\u65f6\u6587\u4ef6\u3002<\/li>\n<li><strong>dist\u6587\u4ef6\u5939<\/strong>\uff1a\u8fd9\u662f\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\u6240\u5728\u7684\u6587\u4ef6\u5939\u3002<code>hello.exe<\/code>\u5c06\u4f4d\u4e8e\u6b64\u6587\u4ef6\u5939\u4e2d\u3002<\/li>\n<li><strong><code>.spec<\/code>\u6587\u4ef6<\/strong>\uff1a\u8fd9\u662f\u4e00\u4e2aPyInstaller\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u8bb0\u5f55\u4e86\u6784\u5efa\u53ef\u6267\u884c\u6587\u4ef6\u6240\u9700\u7684\u4fe1\u606f\u3002\u53ef\u4ee5\u6839\u636e\u9700\u8981\u7f16\u8f91\u8fd9\u4e2a\u6587\u4ef6\u6765\u8c03\u6574\u6784\u5efa\u8fc7\u7a0b\u3002<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u8fd0\u884c\u751f\u6210\u7684EXE\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u5728\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u540e\uff0c\u53ef\u4ee5\u5728\u4e0d\u5b89\u88c5Python\u7684\u60c5\u51b5\u4e0b\u5728Windows\u7cfb\u7edf\u4e0a\u8fd0\u884c\u5b83\u3002\u5bfc\u822a\u5230<code>dist<\/code>\u6587\u4ef6\u5939\uff0c\u53cc\u51fb<code>hello.exe<\/code>\u5373\u53ef\u8fd0\u884c\u7a0b\u5e8f\u3002\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u5e94\u8be5\u4f1a\u5728\u63a7\u5236\u53f0\u4e2d\u770b\u5230\u201cHello, World!\u201d\u7684\u8f93\u51fa\u3002<\/p>\n<\/p>\n<p><p>\u516d\u3001\u5904\u7406\u5916\u90e8\u6587\u4ef6\u548c\u4f9d\u8d56\u9879<\/p>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0cPython\u811a\u672c\u53ef\u80fd\u4f9d\u8d56\u4e8e\u5916\u90e8\u6587\u4ef6\uff08\u5982\u914d\u7f6e\u6587\u4ef6\u3001\u6570\u636e\u6587\u4ef6\u7b49\uff09\u6216\u7b2c\u4e09\u65b9\u5e93\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u786e\u4fdd\u8fd9\u4e9b\u6587\u4ef6\u6216\u5e93\u5728\u6253\u5305\u65f6\u6b63\u786e\u5305\u542b\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u5305\u542b\u5916\u90e8\u6587\u4ef6<\/strong>\uff1a\u53ef\u4ee5\u901a\u8fc7\u5728<code>.spec<\/code>\u6587\u4ef6\u4e2d\u6dfb\u52a0\u76f8\u5173\u4fe1\u606f\u6765\u5305\u542b\u5916\u90e8\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u5c06\u6587\u4ef6\u8def\u5f84\u6dfb\u52a0\u5230<code>datas<\/code>\u53c2\u6570\u4e2d\u3002<\/li>\n<li><strong>\u5904\u7406\u7b2c\u4e09\u65b9\u5e93<\/strong>\uff1a\u901a\u5e38\uff0cPyInstaller\u53ef\u4ee5\u81ea\u52a8\u68c0\u6d4b\u5e76\u5305\u542b\u5927\u591a\u6570\u7b2c\u4e09\u65b9\u5e93\uff0c\u4f46\u6709\u65f6\u53ef\u80fd\u9700\u8981\u624b\u52a8\u8c03\u6574\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f7f\u7528\u7684\u662f\u975e\u6807\u51c6\u5e93\uff0c\u53ef\u80fd\u9700\u8981\u5728<code>.spec<\/code>\u6587\u4ef6\u4e2d\u8fdb\u884c\u989d\u5916\u914d\u7f6e\u3002<\/li>\n<\/ol>\n<p><p>\u4e03\u3001\u4f18\u5316\u548c\u8c03\u6574EXE\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u751f\u6210\u7684EXE\u6587\u4ef6\u53ef\u80fd\u4f1a\u6bd4\u8f83\u5927\uff0c\u56e0\u4e3a\u5b83\u5305\u542b\u4e86\u89e3\u91ca\u5668\u548c\u6240\u6709\u5fc5\u8981\u7684\u5e93\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u4f18\u5316\u5927\u5c0f\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528UPX<\/strong>\uff1aUPX\u662f\u4e00\u79cd\u53ef\u6267\u884c\u6587\u4ef6\u538b\u7f29\u5668\uff0c\u53ef\u4ee5\u663e\u8457\u51cf\u5c11\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u786e\u4fdd\u5728\u7cfb\u7edf\u4e2d\u5b89\u88c5\u4e86UPX\uff0c\u7136\u540e\u5728\u6253\u5305\u65f6\u4f7f\u7528<code>--upx-dir<\/code>\u9009\u9879\u6307\u5b9aUPX\u7684\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile --upx-dir \/path\/to\/upx hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6392\u9664\u4e0d\u5fc5\u8981\u7684\u6a21\u5757<\/strong>\uff1a\u53ef\u4ee5\u5728<code>.spec<\/code>\u6587\u4ef6\u4e2d\u4f7f\u7528<code>excludes<\/code>\u53c2\u6570\u6392\u9664\u4e0d\u5fc5\u8981\u7684\u6a21\u5757\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u7684\u811a\u672c\u4e0d\u9700\u8981GUI\uff0c\u53ef\u4ee5\u6392\u9664tkinter\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516b\u3001\u5904\u7406\u5e38\u89c1\u95ee\u9898\u548c\u9519\u8bef<\/p>\n<\/p>\n<p><p>\u5728\u4f7f\u7528PyInstaller\u6253\u5305Python\u811a\u672c\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u548c\u9519\u8bef\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u7f3a\u5c11\u6a21\u5757\u9519\u8bef<\/strong>\uff1a\u5982\u679c\u5728\u8fd0\u884cEXE\u6587\u4ef6\u65f6\u51fa\u73b0\u7f3a\u5c11\u6a21\u5757\u7684\u9519\u8bef\uff0c\u53ef\u80fd\u662f\u56e0\u4e3aPyInstaller\u672a\u6b63\u786e\u68c0\u6d4b\u5230\u4f9d\u8d56\u9879\u3002\u53ef\u4ee5\u901a\u8fc7\u5728<code>.spec<\/code>\u6587\u4ef6\u4e2d\u624b\u52a8\u6dfb\u52a0\u6a21\u5757\u6765\u89e3\u51b3\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8def\u5f84\u95ee\u9898<\/strong>\uff1a\u67d0\u4e9b\u811a\u672c\u4f9d\u8d56\u4e8e\u76f8\u5bf9\u8def\u5f84\uff0c\u800c\u6253\u5305\u540e\u53ef\u80fd\u4f1a\u5bfc\u81f4\u8def\u5f84\u9519\u8bef\u3002\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528<code>os.path<\/code>\u6a21\u5757\u4e2d\u7684<code>sys._MEIPASS<\/code>\u6765\u89e3\u51b3\uff0c\u8fd9\u662fPyInstaller\u63d0\u4f9b\u7684\u8def\u5f84\u53d8\u91cf\uff0c\u6307\u5411\u6253\u5305\u540e\u4e34\u65f6\u6587\u4ef6\u5939\u7684\u8def\u5f84\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u517c\u5bb9\u6027\u95ee\u9898<\/strong>\uff1a\u786e\u4fdd\u4f7f\u7528\u7684Python\u7248\u672c\u548cPyInstaller\u7248\u672c\u662f\u517c\u5bb9\u7684\u3002\u5982\u679c\u4f7f\u7528\u7684\u662fPython\u7684\u8f83\u65b0\u7248\u672c\uff0c\u53ef\u80fd\u9700\u8981\u66f4\u65b0PyInstaller\u4ee5\u786e\u4fdd\u517c\u5bb9\u6027\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e5d\u3001\u4e86\u89e3\u5176\u4ed6\u6253\u5305\u5de5\u5177<\/p>\n<\/p>\n<p><p>\u867d\u7136PyInstaller\u662f\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684\u5de5\u5177\uff0c\u4f46\u8fd8\u6709\u5176\u4ed6\u5de5\u5177\u53ef\u4ee5\u7528\u4e8e\u5c06Python\u811a\u672c\u6253\u5305\u4e3aEXE\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>cx_Freeze<\/strong>\uff1a\u8fd9\u662f\u53e6\u4e00\u4e2a\u6d41\u884c\u7684\u6253\u5305\u5de5\u5177\uff0c\u652f\u6301Windows\u3001Mac\u548cLinux\u3002cx_Freeze\u9002\u5408\u9700\u8981\u8de8\u5e73\u53f0\u652f\u6301\u7684\u9879\u76ee\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Py2exe<\/strong>\uff1a\u4e13\u95e8\u7528\u4e8e\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3aWindows\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u4f46\u4e0d\u5982PyInstaller\u5e7f\u6cdb\u4f7f\u7528\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Nuitka<\/strong>\uff1a\u4e0e\u5176\u4ed6\u5de5\u5177\u4e0d\u540c\uff0cNuitka\u5c06Python\u4ee3\u7801\u8f6c\u6362\u4e3aC\u4ee3\u7801\uff0c\u7136\u540e\u7f16\u8bd1\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u53ef\u80fd\u63d0\u4f9b\u66f4\u597d\u7684\u6027\u80fd\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u5341\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3aEXE\u6587\u4ef6\u662f\u4e00\u9879\u975e\u5e38\u6709\u7528\u7684\u6280\u80fd\uff0c\u5c24\u5176\u662f\u5728\u9700\u8981\u5c06Python\u5e94\u7528\u7a0b\u5e8f\u5206\u53d1\u7ed9\u6ca1\u6709Python\u73af\u5883\u7684\u7528\u6237\u65f6\u3002PyInstaller\u662f\u4e00\u4e2a\u5f3a\u5927\u4e14\u6613\u4e8e\u4f7f\u7528\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5feb\u901f\u5b8c\u6210\u8fd9\u4e2a\u4efb\u52a1\u3002\u901a\u8fc7\u719f\u6089PyInstaller\u7684\u57fa\u672c\u7528\u6cd5\u3001\u914d\u7f6e\u9009\u9879\u548c\u5e38\u89c1\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u5c06\u4f60\u7684Python\u9879\u76ee\u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\uff1f<\/strong><br \/>\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u901a\u5e38\u4f7f\u7528\u5de5\u5177\u5982PyInstaller\u6216cx_Freeze\u3002\u5b89\u88c5\u8fd9\u4e9b\u5de5\u5177\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u7b80\u5355\u7684\u547d\u4ee4\u884c\u6307\u4ee4\u6765\u751f\u6210exe\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u4f7f\u7528PyInstaller\u65f6\uff0c\u60a8\u53ea\u9700\u5728\u547d\u4ee4\u884c\u8f93\u5165<code>pyinstaller your_script.py<\/code>\uff0c\u5b83\u4f1a\u5728\u751f\u6210\u7684dist\u6587\u4ef6\u5939\u4e2d\u627e\u5230\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p><strong>\u5728\u8f6c\u6362\u8fc7\u7a0b\u4e2d\u662f\u5426\u9700\u8981\u8003\u8651\u4f9d\u8d56\u5e93\u7684\u95ee\u9898\uff1f<\/strong><br \/>\u662f\u7684\uff0c\u8f6c\u6362Python\u811a\u672c\u4e3aexe\u6587\u4ef6\u65f6\uff0c\u9700\u8981\u786e\u4fdd\u6240\u6709\u4f9d\u8d56\u7684\u5e93\u90fd\u88ab\u6b63\u786e\u6253\u5305\u3002PyInstaller\u4f1a\u81ea\u52a8\u68c0\u6d4b\u5e76\u5305\u542b\u5927\u90e8\u5206\u4f9d\u8d56\uff0c\u4f46\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u624b\u52a8\u6307\u5b9a\u67d0\u4e9b\u9690\u85cf\u7684\u4f9d\u8d56\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528<code>--hidden-import<\/code>\u9009\u9879\u6765\u5b9e\u73b0\u3002<\/p>\n<p><strong>\u751f\u6210\u7684exe\u6587\u4ef6\u5728\u5176\u4ed6\u7535\u8111\u4e0a\u80fd\u5426\u6b63\u5e38\u8fd0\u884c\uff1f<\/strong><br \/>\u751f\u6210\u7684exe\u6587\u4ef6\u5728\u5176\u4ed6\u7535\u8111\u4e0a\u8fd0\u884c\u65f6\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u5c24\u5176\u662f\u5728\u6ca1\u6709\u5b89\u88c5Python\u73af\u5883\u7684\u7cfb\u7edf\u4e0a\u3002\u4e3a\u786e\u4fdd\u53ef\u6267\u884c\u6587\u4ef6\u7684\u517c\u5bb9\u6027\uff0c\u5efa\u8bae\u5728\u76ee\u6807\u7535\u8111\u4e0a\u8fdb\u884c\u6d4b\u8bd5\u3002\u5982\u679c\u9700\u8981\u5728\u6ca1\u6709Python\u7684\u73af\u5883\u4e2d\u8fd0\u884c\uff0c\u53ef\u4ee5\u9009\u62e9\u5c06\u6240\u9700\u7684Python\u8fd0\u884c\u65f6\u4e00\u5e76\u6253\u5305\uff0c\u6216\u4f7f\u7528\u5982PyInstaller\u7684<code>--onefile<\/code>\u9009\u9879\u5c06\u6240\u6709\u5185\u5bb9\u6253\u5305\u6210\u4e00\u4e2a\u5355\u72ec\u7684exe\u6587\u4ef6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\uff08EXE\uff09\uff0c\u53ef\u4ee5\u4f7f\u7528\u5de5\u5177\u5982PyInstaller\u3001cx_Freeze\u3001Py [&hellip;]","protected":false},"author":3,"featured_media":932098,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/932094"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=932094"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/932094\/revisions"}],"predecessor-version":[{"id":932100,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/932094\/revisions\/932100"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/932098"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=932094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=932094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=932094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}