{"id":1012786,"date":"2024-12-27T11:42:16","date_gmt":"2024-12-27T03:42:16","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1012786.html"},"modified":"2024-12-27T11:42:20","modified_gmt":"2024-12-27T03:42:20","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e7%94%9f%e6%88%90exe","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1012786.html","title":{"rendered":"\u5982\u4f55\u7528python\u751f\u6210exe"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25090429\/3880a597-ed33-4691-a9be-88be2a8e3394.webp\" alt=\"\u5982\u4f55\u7528python\u751f\u6210exe\" \/><\/p>\n<p><p> \u5f00\u5934\u6bb5\u843d\uff1a<br \/><strong>\u7528Python\u751f\u6210exe\u6587\u4ef6\u7684\u4e3b\u8981\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528PyInstaller\u3001cx_Freeze\u3001py2exe\u7b49\u5de5\u5177\u3002\u8fd9\u4e9b\u5de5\u5177\u5c06Python\u811a\u672c\u6253\u5305\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u4f7f\u5176\u80fd\u5728\u6ca1\u6709Python\u73af\u5883\u7684\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u3002<\/strong>\u5176\u4e2d\uff0cPyInstaller\u662f\u6700\u5e38\u7528\u4e14\u529f\u80fd\u5f3a\u5927\u7684\u5de5\u5177\u4e4b\u4e00\uff0c\u56e0\u4e3a\u5b83\u652f\u6301\u591a\u5e73\u53f0\u3001\u6613\u4e8e\u4f7f\u7528\uff0c\u5e76\u4e14\u80fd\u591f\u81ea\u52a8\u5904\u7406\u5927\u90e8\u5206\u4f9d\u8d56\u9879\u3002\u4f7f\u7528PyInstaller\uff0c\u53ea\u9700\u7b80\u5355\u7684\u547d\u4ee4\u5373\u53ef\u5b8c\u6210\u6253\u5305\u8fc7\u7a0b\u3002\u4f7f\u7528PyInstaller\u65f6\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u5b83\uff0c\u7136\u540e\u901a\u8fc7\u547d\u4ee4\u884c\u5de5\u5177\u6307\u5b9aPython\u811a\u672c\u548c\u6253\u5305\u9009\u9879\uff0c\u6700\u7ec8\u751f\u6210\u7684exe\u6587\u4ef6\u4f1a\u5305\u542b\u6240\u6709\u7684\u4f9d\u8d56\u5e93\uff0c\u4f7f\u5176\u53ef\u4ee5\u5728\u76ee\u6807\u7cfb\u7edf\u4e0a\u72ec\u7acb\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><p>\u6b63\u6587\uff1a  <\/p>\n<\/p>\n<h2><strong>\u4e00\u3001PYINSTALLER\uff1a\u4f7f\u7528\u4e0e\u5b89\u88c5<\/strong><\/h2>\n<p><p>PyInstaller\u662f\u6700\u5e38\u7528\u7684Python\u811a\u672c\u6253\u5305\u5de5\u5177\u4e4b\u4e00\uff0c\u5b83\u652f\u6301Windows\u3001Linux\u548cMac OS X\u7b49\u591a\u4e2a\u64cd\u4f5c\u7cfb\u7edf\u3002PyInstaller\u7684\u4f18\u52bf\u5728\u4e8e\u5176\u7b80\u5355\u6027\u548c\u5f3a\u5927\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u81ea\u52a8\u68c0\u6d4b\u548c\u6253\u5305\u5927\u90e8\u5206\u7684Python\u5e93\u3002<\/p>\n<\/p>\n<p><h2>1. \u5b89\u88c5PYINSTALLER<\/h2>\n<\/p>\n<p><p>\u8981\u4f7f\u7528PyInstaller\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u5b83\u3002\u53ef\u4ee5\u901a\u8fc7Python\u7684\u5305\u7ba1\u7406\u5668pip\u8fdb\u884c\u5b89\u88c5\u3002\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pyinstaller<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u4f1a\u4ecePython\u7684\u5b98\u65b9\u5305\u7ba1\u7406\u5e93\u4e2d\u4e0b\u8f7d\u5e76\u5b89\u88c5PyInstaller\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u8f93\u5165<code>pyinstaller<\/code>\u547d\u4ee4\u6765\u68c0\u67e5\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002<\/p>\n<\/p>\n<p><h2>2. \u4f7f\u7528PYINSTALLER\u751f\u6210EXE<\/h2>\n<\/p>\n<p><p>PyInstaller\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u5de5\u5177\u6765\u6253\u5305Python\u811a\u672c\u3002\u5047\u8bbe\u60a8\u6709\u4e00\u4e2a\u540d\u4e3a<code>myscript.py<\/code>\u7684Python\u811a\u672c\uff0c\u60f3\u8981\u5c06\u5176\u6253\u5305\u6210exe\u6587\u4ef6\uff0c\u53ea\u9700\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile myscript.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><code>--onefile<\/code>\u9009\u9879\u6307\u793aPyInstaller\u5c06\u6240\u6709\u5185\u5bb9\u6253\u5305\u6210\u4e00\u4e2a\u5355\u72ec\u7684exe\u6587\u4ef6\u3002\u6b64\u547d\u4ee4\u4f1a\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u751f\u6210\u4e00\u4e2a<code>dist<\/code>\u76ee\u5f55\uff0c\u91cc\u9762\u5305\u542b\u751f\u6210\u7684exe\u6587\u4ef6\u3002<\/p>\n<\/p>\n<h2><strong>\u4e8c\u3001CX_FREEZE\uff1a\u53e6\u4e00\u4e2a\u9009\u62e9<\/strong><\/h2>\n<p><p>cx_Freeze\u662f\u53e6\u4e00\u4e2a\u5e38\u7528\u7684Python\u811a\u672c\u6253\u5305\u5de5\u5177\uff0c\u4e0ePyInstaller\u7c7b\u4f3c\uff0ccx_Freeze\u4e5f\u80fd\u591f\u5c06Python\u811a\u672c\u6253\u5305\u6210\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5e76\u652f\u6301\u591a\u5e73\u53f0\u3002<\/p>\n<\/p>\n<p><h2>1. \u5b89\u88c5CX_FREEZE<\/h2>\n<\/p>\n<p><p>\u540c\u6837\uff0c\u53ef\u4ee5\u901a\u8fc7pip\u6765\u5b89\u88c5cx_Freeze\u3002\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\uff0c\u8f93\u5165\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install cx_Freeze<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u5728Python\u811a\u672c\u4e2d\u4f7f\u7528cx_Freeze\u7684\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><h2>2. \u4f7f\u7528CX_FREEZE\u751f\u6210EXE<\/h2>\n<\/p>\n<p><p>\u4e0ePyInstaller\u4e0d\u540c\uff0ccx_Freeze\u9700\u8981\u7f16\u5199\u4e00\u4e2asetup\u811a\u672c\u6765\u914d\u7f6e\u6253\u5305\u8fc7\u7a0b\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from cx_Freeze import setup, Executable<\/p>\n<p>setup(<\/p>\n<p>    name = &quot;MyApp&quot;,<\/p>\n<p>    version = &quot;0.1&quot;,<\/p>\n<p>    description = &quot;My Python application&quot;,<\/p>\n<p>    executables = [Executable(&quot;myscript.py&quot;)]<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5c06\u4ee5\u4e0a\u811a\u672c\u4fdd\u5b58\u4e3a<code>setup.py<\/code>\uff0c\u7136\u540e\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python setup.py build<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u4f1a\u5728<code>build<\/code>\u76ee\u5f55\u4e2d\u751f\u6210exe\u6587\u4ef6\u3002<\/p>\n<\/p>\n<h2><strong>\u4e09\u3001PY2EXE\uff1a\u7ecf\u5178\u5de5\u5177<\/strong><\/h2>\n<p><p>py2exe\u662f\u4e00\u4e2a\u7ecf\u5178\u7684Python\u6253\u5305\u5de5\u5177\uff0c\u4e13\u95e8\u7528\u4e8e\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3aWindows\u53ef\u6267\u884c\u6587\u4ef6\u3002\u867d\u7136\u4e0d\u5982PyInstaller\u548ccx_Freeze\u6d41\u884c\uff0c\u4f46\u5728\u67d0\u4e9b\u7279\u5b9a\u573a\u666f\u4e0b\u4ecd\u7136\u6709\u7528\u3002<\/p>\n<\/p>\n<p><h2>1. \u5b89\u88c5PY2EXE<\/h2>\n<\/p>\n<p><p>py2exe\u7684\u5b89\u88c5\u8fc7\u7a0b\u4e5f\u5f88\u7b80\u5355\uff0c\u4f7f\u7528pip\u5373\u53ef\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install py2exe<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>2. \u4f7f\u7528PY2EXE\u751f\u6210EXE<\/h2>\n<\/p>\n<p><p>\u4e0ecx_Freeze\u7c7b\u4f3c\uff0cpy2exe\u4e5f\u9700\u8981\u7f16\u5199\u4e00\u4e2asetup\u811a\u672c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from distutils.core import setup<\/p>\n<p>import py2exe<\/p>\n<p>setup(<\/p>\n<p>    console=[&#39;myscript.py&#39;]<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4fdd\u5b58\u4e3a<code>setup.py<\/code>\uff0c\u7136\u540e\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python setup.py py2exe<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u5c06\u5728<code>dist<\/code>\u76ee\u5f55\u4e2d\u521b\u5efaexe\u6587\u4ef6\u3002<\/p>\n<\/p>\n<h2><strong>\u56db\u3001\u6253\u5305\u8fc7\u7a0b\u4e2d\u7684\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6848<\/strong><\/h2>\n<p><p>\u5728\u5c06Python\u811a\u672c\u6253\u5305\u4e3aexe\u6587\u4ef6\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u5e38\u89c1\u7684\u95ee\u9898\u3002\u4e86\u89e3\u8fd9\u4e9b\u95ee\u9898\u53ca\u5176\u89e3\u51b3\u65b9\u6848\u5c06\u6709\u52a9\u4e8e\u987a\u5229\u5b8c\u6210\u6253\u5305\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<p><h2>1. \u7f3a\u5c11\u4f9d\u8d56\u5e93<\/h2>\n<\/p>\n<p><p>\u6709\u65f6\u5019\uff0c\u6253\u5305\u5de5\u5177\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u8bc6\u522b\u548c\u6253\u5305\u6240\u6709\u7684\u4f9d\u8d56\u5e93\u3002\u8fd9\u901a\u5e38\u4f1a\u5bfc\u81f4\u751f\u6210\u7684exe\u6587\u4ef6\u5728\u8fd0\u884c\u65f6\u51fa\u73b0\u9519\u8bef\u3002\u53ef\u4ee5\u901a\u8fc7\u624b\u52a8\u6dfb\u52a0\u7f3a\u5c11\u7684\u4f9d\u8d56\u5e93\u6765\u89e3\u51b3\u6b64\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><p>\u4f8b\u5982\uff0c\u5728\u4f7f\u7528PyInstaller\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>--hidden-import<\/code>\u9009\u9879\u6307\u5b9a\u989d\u5916\u7684\u4f9d\u8d56\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile --hidden-import=missing_module myscript.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>2. \u6253\u5305\u540e\u7684\u6587\u4ef6\u8fc7\u5927<\/h2>\n<\/p>\n<p><p>\u7531\u4e8ePython\u89e3\u91ca\u5668\u548c\u6240\u6709\u4f9d\u8d56\u5e93\u90fd\u88ab\u6253\u5305\u5230exe\u6587\u4ef6\u4e2d\uff0c\u751f\u6210\u7684\u6587\u4ef6\u53ef\u80fd\u4f1a\u5f88\u5927\u3002\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u538b\u7f29\u5de5\u5177\u6216\u5220\u9664\u4e0d\u5fc5\u8981\u7684\u5e93\u6765\u51cf\u5c0f\u6587\u4ef6\u5927\u5c0f\u3002<\/p>\n<\/p>\n<p><p>\u5bf9\u4e8ePyInstaller\uff0c\u53ef\u4ee5\u4f7f\u7528<code>--exclude-module<\/code>\u9009\u9879\u6392\u9664\u4e0d\u9700\u8981\u7684\u6a21\u5757\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile --exclude-module=unnecessary_module myscript.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>3. \u56fe\u5f62\u754c\u9762\u7a0b\u5e8f\u7684\u652f\u6301<\/h2>\n<\/p>\n<p><p>\u5982\u679c\u60a8\u6b63\u5728\u6253\u5305\u4e00\u4e2a\u4f7f\u7528\u56fe\u5f62\u754c\u9762\u7684Python\u5e94\u7528\u7a0b\u5e8f\uff08\u5982Tkinter\u6216PyQt\uff09\uff0c\u53ef\u80fd\u9700\u8981\u989d\u5916\u7684\u914d\u7f6e\u3002\u4f8b\u5982\uff0c\u5bf9\u4e8ePyInstaller\uff0c\u53ef\u4ee5\u4f7f\u7528<code>--windowed<\/code>\u9009\u9879\u6765\u9690\u85cf\u63a7\u5236\u53f0\u7a97\u53e3\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile --windowed myscript.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<h2><strong>\u4e94\u3001\u6700\u4f73\u5b9e\u8df5\u548c\u6ce8\u610f\u4e8b\u9879<\/strong><\/h2>\n<p><p>\u5728\u5c06Python\u811a\u672c\u6253\u5305\u4e3aexe\u6587\u4ef6\u65f6\uff0c\u9075\u5faa\u4e00\u4e9b\u6700\u4f73\u5b9e\u8df5\u53ef\u4ee5\u5e2e\u52a9\u786e\u4fdd\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\u7a33\u5065\u53ef\u9760\u3002<\/p>\n<\/p>\n<p><h2>1. \u6d4b\u8bd5\u751f\u6210\u7684EXE\u6587\u4ef6<\/h2>\n<\/p>\n<p><p>\u5728\u5c06\u751f\u6210\u7684exe\u6587\u4ef6\u5206\u53d1\u7ed9\u7528\u6237\u4e4b\u524d\uff0c\u52a1\u5fc5\u5728\u591a\u53f0\u8ba1\u7b97\u673a\u4e0a\u8fdb\u884c\u6d4b\u8bd5\uff0c\u4ee5\u786e\u4fdd\u5176\u80fd\u591f\u6b63\u5e38\u8fd0\u884c\u5e76\u63d0\u4f9b\u9884\u671f\u529f\u80fd\u3002\u7279\u522b\u662f\u8981\u5728\u6ca1\u6709\u5b89\u88c5Python\u73af\u5883\u7684\u8ba1\u7b97\u673a\u4e0a\u8fdb\u884c\u6d4b\u8bd5\u3002<\/p>\n<\/p>\n<p><h2>2. \u66f4\u65b0\u6253\u5305\u5de5\u5177<\/h2>\n<\/p>\n<p><p>\u6253\u5305\u5de5\u5177\u4f1a\u968f\u7740\u65f6\u95f4\u7684\u63a8\u79fb\u8fdb\u884c\u66f4\u65b0\uff0c\u4ee5\u4fee\u590dbug\u548c\u589e\u52a0\u65b0\u529f\u80fd\u3002\u56e0\u6b64\uff0c\u5b9a\u671f\u68c0\u67e5\u5e76\u66f4\u65b0\u60a8\u4f7f\u7528\u7684\u6253\u5305\u5de5\u5177\u662f\u4e2a\u597d\u4e60\u60ef\u3002\u8fd9\u53ef\u4ee5\u901a\u8fc7pip\u7684\u5347\u7ea7\u547d\u4ee4\u6765\u5b8c\u6210\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install --upgrade pyinstaller<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>3. \u5904\u7406\u8bb8\u53ef\u8bc1\u548c\u7248\u6743\u95ee\u9898<\/h2>\n<\/p>\n<p><p>\u5728\u5c06Python\u811a\u672c\u6253\u5305\u5e76\u5206\u53d1\u65f6\uff0c\u53ef\u80fd\u6d89\u53ca\u5230\u7b2c\u4e09\u65b9\u5e93\u7684\u8bb8\u53ef\u8bc1\u548c\u7248\u6743\u95ee\u9898\u3002\u786e\u4fdd\u9075\u5faa\u6240\u6709\u76f8\u5173\u7684\u6cd5\u5f8b\u548c\u8bb8\u53ef\u8bc1\u8981\u6c42\uff0c\u4ee5\u907f\u514d\u6cd5\u5f8b\u7ea0\u7eb7\u3002<\/p>\n<\/p>\n<h2><strong>\u516d\u3001\u7ed3\u8bba<\/strong><\/h2>\n<p><p>\u5c06Python\u811a\u672c\u6253\u5305\u4e3aexe\u6587\u4ef6\u662f\u4e00\u9879\u91cd\u8981\u7684\u6280\u80fd\uff0c\u7279\u522b\u662f\u5f53\u60a8\u5e0c\u671b\u5728\u6ca1\u6709Python\u73af\u5883\u7684\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u60a8\u7684\u7a0b\u5e8f\u65f6\u3002\u901a\u8fc7\u4f7f\u7528PyInstaller\u3001cx_Freeze\u548cpy2exe\u7b49\u5de5\u5177\uff0c\u60a8\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u3002\u4e86\u89e3\u8fd9\u4e9b\u5de5\u5177\u7684\u4f7f\u7528\u65b9\u6cd5\u3001\u89e3\u51b3\u5e38\u89c1\u95ee\u9898\u4ee5\u53ca\u9075\u5faa\u6700\u4f73\u5b9e\u8df5\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u6210\u529f\u5730\u5b8c\u6210\u6253\u5305\u4efb\u52a1\u3002\u65e0\u8bba\u662f\u7b80\u5355\u7684\u547d\u4ee4\u884c\u5de5\u5177\u8fd8\u662f\u590d\u6742\u7684\u56fe\u5f62\u754c\u9762\u5e94\u7528\u7a0b\u5e8f\uff0cPython\u7684\u4e30\u5bcc\u751f\u6001\u7cfb\u7edf\u90fd\u80fd\u63d0\u4f9b\u76f8\u5e94\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u786e\u4fdd\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u80fd\u591f\u987a\u5229\u8fd0\u884c\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 \/>\u8981\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u50cfPyInstaller\u3001cx_Freeze\u6216py2exe\u7b49\u5de5\u5177\u3002\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u5c06Python\u4ee3\u7801\u6253\u5305\u6210\u72ec\u7acb\u7684.exe\u6587\u4ef6\uff0c\u4f7f\u5176\u5728\u6ca1\u6709Python\u73af\u5883\u7684\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u3002PyInstaller\u662f\u6700\u53d7\u6b22\u8fce\u7684\u9009\u62e9\uff0c\u56e0\u4e3a\u5b83\u64cd\u4f5c\u7b80\u5355\u4e14\u652f\u6301\u591a\u79cd\u5e73\u53f0\u3002\u5728\u4f7f\u7528\u65f6\uff0c\u60a8\u53ea\u9700\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c\u7b80\u5355\u7684\u547d\u4ee4\uff0c\u5e76\u6307\u5b9a\u8981\u6253\u5305\u7684\u811a\u672c\u3002<\/p>\n<p><strong>\u751f\u6210exe\u6587\u4ef6\u65f6\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u4f9d\u8d56\u9879\uff1f<\/strong><br \/>\u5728\u5c06Python\u811a\u672c\u8f6c\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u65f6\uff0c\u786e\u4fdd\u6240\u6709\u4f9d\u8d56\u7684\u5e93\u548c\u6a21\u5757\u90fd\u88ab\u6b63\u786e\u5305\u542b\u5728\u5185\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002\u4f7f\u7528PyInstaller\u65f6\uff0c\u901a\u5e38\u4f1a\u81ea\u52a8\u68c0\u6d4b\u4f9d\u8d56\u9879\uff0c\u4f46\u5efa\u8bae\u5728\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u540e\u8fdb\u884c\u6d4b\u8bd5\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u529f\u80fd\u6b63\u5e38\u3002\u5982\u679c\u60a8\u7684\u7a0b\u5e8f\u4f7f\u7528\u4e86\u5916\u90e8\u6587\u4ef6\u6216\u8d44\u6e90\uff0c\u8bb0\u5f97\u5728\u6253\u5305\u65f6\u6307\u5b9a\u8fd9\u4e9b\u6587\u4ef6\u7684\u8def\u5f84\u3002<\/p>\n<p><strong>\u5728\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u751f\u6210exe\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9650\u5236\uff1f<\/strong><br \/>\u662f\u7684\uff0c\u751f\u6210.exe\u6587\u4ef6\u7684\u5de5\u5177\u901a\u5e38\u5728Windows\u5e73\u53f0\u4e0a\u8fd0\u884c\uff0c\u5176\u4ed6\u64cd\u4f5c\u7cfb\u7edf\uff08\u5982Linux\u6216macOS\uff09\u4e0d\u80fd\u76f4\u63a5\u751f\u6210Windows\u53ef\u6267\u884c\u6587\u4ef6\u3002\u5982\u679c\u9700\u8981\u5728\u4e0d\u540c\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528\u865a\u62df\u673a\u6216Docker\u7b49\u5de5\u5177\u6765\u521b\u5efa\u4e00\u4e2aWindows\u73af\u5883\uff0c\u6216\u8005\u4f7f\u7528\u4ea4\u53c9\u7f16\u8bd1\u6280\u672f\uff0c\u4f46\u8fd9\u901a\u5e38\u6bd4\u8f83\u590d\u6742\u3002\u5bf9\u4e8e\u5927\u591a\u6570\u7528\u6237\uff0c\u5efa\u8bae\u5728Windows\u73af\u5883\u4e2d\u5b8c\u6210\u8fd9\u4e00\u8fc7\u7a0b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5f00\u5934\u6bb5\u843d\uff1a\u7528Python\u751f\u6210exe\u6587\u4ef6\u7684\u4e3b\u8981\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528PyInstaller\u3001cx_Freeze\u3001py2e [&hellip;]","protected":false},"author":3,"featured_media":1012797,"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\/1012786"}],"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=1012786"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1012786\/revisions"}],"predecessor-version":[{"id":1012800,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1012786\/revisions\/1012800"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1012797"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1012786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1012786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1012786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}