{"id":1105415,"date":"2025-01-08T16:30:44","date_gmt":"2025-01-08T08:30:44","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1105415.html"},"modified":"2025-01-08T16:30:46","modified_gmt":"2025-01-08T08:30:46","slug":"%e5%a6%82%e4%bd%95%e5%b0%86python%e6%89%93%e5%8c%85%e4%b8%ba%e7%8b%ac%e7%ab%8b%e7%9a%84%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1105415.html","title":{"rendered":"\u5982\u4f55\u5c06python\u6253\u5305\u4e3a\u72ec\u7acb\u7684\u6587\u4ef6"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25070333\/00012b06-8d8e-47ef-8e8b-8396c4a01275.webp\" alt=\"\u5982\u4f55\u5c06python\u6253\u5305\u4e3a\u72ec\u7acb\u7684\u6587\u4ef6\" \/><\/p>\n<p><p> <strong>\u5c06Python\u6253\u5305\u4e3a\u72ec\u7acb\u7684\u6587\u4ef6\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528PyInstaller\u3001cx_Freeze\u3001py2exe\u7b49\u5de5\u5177\u6765\u5b9e\u73b0\u3002<\/strong> \u8fd9\u4e9b\u5de5\u5177\u90fd\u53ef\u4ee5\u5c06Python\u811a\u672c\u53ca\u5176\u4f9d\u8d56\u9879\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u4f7f\u5f97\u65e0\u9700\u5b89\u88c5Python\u89e3\u91ca\u5668\u5373\u53ef\u8fd0\u884c\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528PyInstaller\u6765\u5b8c\u6210\u8fd9\u4e2a\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001PyInstaller\u7684\u5b89\u88c5\u4e0e\u57fa\u672c\u4f7f\u7528<\/h3>\n<\/p>\n<p><h4>1. \u5b89\u88c5PyInstaller<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u9700\u8981\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86PyInstaller\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pyinstaller<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u57fa\u672c\u4f7f\u7528\u65b9\u6cd5<\/h4>\n<\/p>\n<p><p>\u5047\u8bbe\u6709\u4e00\u4e2a\u540d\u4e3a<code>my_script.py<\/code>\u7684Python\u811a\u672c\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c06\u5176\u6253\u5305\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller my_script.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u751f\u6210\u4e00\u4e2a\u540d\u4e3a<code>dist\/my_script<\/code>\u7684\u76ee\u5f55\uff0c\u5176\u4e2d\u5305\u542b\u6253\u5305\u597d\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001PyInstaller\u7684\u9ad8\u7ea7\u7528\u6cd5<\/h3>\n<\/p>\n<p><h4>1. \u751f\u6210\u5355\u4e2a\u53ef\u6267\u884c\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cPyInstaller\u4f1a\u751f\u6210\u591a\u4e2a\u6587\u4ef6\uff0c\u5982\u679c\u4f60\u5e0c\u671b\u751f\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>--onefile<\/code>\u9009\u9879\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile my_script.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u9690\u85cf\u63a7\u5236\u53f0\u7a97\u53e3<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u8fd0\u884c\u65f6\u770b\u5230\u63a7\u5236\u53f0\u7a97\u53e3\uff0c\u53ef\u4ee5\u4f7f\u7528<code>--noconsole<\/code>\u9009\u9879\uff08\u9002\u7528\u4e8eWindows\uff09\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile --noconsole my_script.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u6307\u5b9a\u56fe\u6807\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u4f60\u53ef\u4ee5\u4f7f\u7528<code>--icon<\/code>\u9009\u9879\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u6307\u5b9a\u4e00\u4e2a\u56fe\u6807\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile --icon=my_icon.ico my_script.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u5904\u7406\u4f9d\u8d56\u9879\u548c\u6570\u636e\u6587\u4ef6<\/h3>\n<\/p>\n<p><h4>1. \u5305\u542b\u6570\u636e\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u6709\u65f6\u4f60\u7684\u811a\u672c\u53ef\u80fd\u4f9d\u8d56\u4e8e\u4e00\u4e9b\u6570\u636e\u6587\u4ef6\uff0c\u8fd9\u4e9b\u6587\u4ef6\u9700\u8981\u5305\u542b\u5728\u6253\u5305\u7684\u53ef\u6267\u884c\u6587\u4ef6\u4e2d\u3002\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539.spec\u6587\u4ef6\u6765\u5b9e\u73b0\u8fd9\u4e00\u70b9\u3002<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u751f\u6210\u4e00\u4e2a.spec\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller my_script.py --onefile --specpath .<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u7f16\u8f91\u751f\u6210\u7684<code>my_script.spec<\/code>\u6587\u4ef6\uff0c\u5c06\u6570\u636e\u6587\u4ef6\u5305\u542b\u8fdb\u53bb\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">a = Analysis(<\/p>\n<p>    [&#39;my_script.py&#39;],<\/p>\n<p>    pathex=[&#39;\/path\/to\/your\/script&#39;],<\/p>\n<p>    binaries=[],<\/p>\n<p>    datas=[(&#39;path\/to\/data\/file&#39;, &#39;destination\/path&#39;)],<\/p>\n<p>    ...<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u52a8\u6001\u5e93\u7684\u5904\u7406<\/h4>\n<\/p>\n<p><p>\u67d0\u4e9bPython\u5305\u53ef\u80fd\u4f7f\u7528\u52a8\u6001\u5e93\uff0c\u8fd9\u4e9b\u5e93\u9700\u8981\u5728\u6253\u5305\u65f6\u5305\u542b\u8fdb\u53bb\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539.spec\u6587\u4ef6\u4e2d\u7684<code>binaries<\/code>\u9879\u6765\u624b\u52a8\u6dfb\u52a0\u8fd9\u4e9b\u5e93\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528cx_Freeze\u8fdb\u884c\u6253\u5305<\/h3>\n<\/p>\n<p><p>\u9664\u4e86PyInstaller\uff0ccx_Freeze\u4e5f\u662f\u4e00\u4e2a\u5e38\u7528\u7684\u6253\u5305\u5de5\u5177\u3002\u4e0b\u9762\u662f\u4f7f\u7528cx_Freeze\u7684\u57fa\u672c\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5cx_Freeze<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u5b89\u88c5cx_Freeze\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install cx_Freeze<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u7f16\u5199setup\u811a\u672c<\/h4>\n<\/p>\n<p><p>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>setup.py<\/code>\u7684\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\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 Application&quot;,<\/p>\n<p>    executables=[Executable(&quot;my_script.py&quot;)]<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u8fd0\u884csetup\u811a\u672c<\/h4>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\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>\u8fd9\u5c06\u5728<code>build<\/code>\u76ee\u5f55\u4e2d\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u4f7f\u7528py2exe\u8fdb\u884c\u6253\u5305<\/h3>\n<\/p>\n<p><p>\u867d\u7136py2exe\u4e3b\u8981\u7528\u4e8eWindows\uff0c\u4f46\u5b83\u4e5f\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u5de5\u5177\u3002\u4ee5\u4e0b\u662f\u57fa\u672c\u4f7f\u7528\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5py2exe<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u5b89\u88c5py2exe\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install py2exe<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u7f16\u5199setup\u811a\u672c<\/h4>\n<\/p>\n<p><p>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>setup.py<\/code>\u7684\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\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;my_script.py&#39;]<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u8fd0\u884csetup\u811a\u672c<\/h4>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\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>\u8fd9\u5c06\u5728<code>dist<\/code>\u76ee\u5f55\u4e2d\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u6d4b\u8bd5\u548c\u5206\u53d1<\/h3>\n<\/p>\n<p><h4>1. \u6d4b\u8bd5\u53ef\u6267\u884c\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u5728\u6253\u5305\u5b8c\u6210\u540e\uff0c\u4e00\u5b9a\u8981\u5728\u76ee\u6807\u73af\u5883\u4e2d\u6d4b\u8bd5\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u786e\u4fdd\u5176\u6b63\u5e38\u8fd0\u884c\u3002\u8fd9\u6837\u53ef\u4ee5\u53d1\u73b0\u5e76\u89e3\u51b3\u53ef\u80fd\u5b58\u5728\u7684\u517c\u5bb9\u6027\u95ee\u9898\u6216\u7f3a\u5931\u7684\u4f9d\u8d56\u9879\u3002<\/p>\n<\/p>\n<p><h4>2. \u5206\u53d1\u53ef\u6267\u884c\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u4f60\u53ef\u4ee5\u5c06\u6253\u5305\u597d\u7684\u53ef\u6267\u884c\u6587\u4ef6\u53ca\u5176\u76f8\u5173\u6587\u4ef6\u5939\u8fdb\u884c\u538b\u7f29\uff0c\u7136\u540e\u901a\u8fc7\u7f51\u7edc\u3001U\u76d8\u7b49\u65b9\u5f0f\u5206\u53d1\u7ed9\u7528\u6237\u3002\u786e\u4fdd\u4f60\u63d0\u4f9b\u7684\u6587\u4ef6\u4e2d\u5305\u542b\u6240\u6709\u5fc5\u8981\u7684\u4f9d\u8d56\u9879\u548c\u6570\u636e\u6587\u4ef6\uff0c\u4ee5\u786e\u4fdd\u7a0b\u5e8f\u80fd\u591f\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u5e38\u89c1\u95ee\u9898\u548c\u89e3\u51b3\u65b9\u6848<\/h3>\n<\/p>\n<p><h4>1. \u7f3a\u5c11\u4f9d\u8d56\u9879<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u6253\u5305\u540e\u7684\u53ef\u6267\u884c\u6587\u4ef6\u8fd0\u884c\u65f6\u62a5\u9519\uff0c\u63d0\u793a\u7f3a\u5c11\u67d0\u4e9b\u4f9d\u8d56\u9879\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u6765\u89e3\u51b3\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u68c0\u67e5.spec\u6587\u4ef6\u4e2d\u7684<code>datas<\/code>\u548c<code>binaries<\/code>\u9879\uff0c\u786e\u4fdd\u6240\u6709\u4f9d\u8d56\u9879\u90fd\u5df2\u5305\u542b\u3002<\/li>\n<li>\u4f7f\u7528<code>--hidden-import<\/code>\u9009\u9879\u663e\u5f0f\u6307\u5b9a\u672a\u68c0\u6d4b\u5230\u7684\u4f9d\u8d56\u9879\uff1a<\/li>\n<\/ul>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile --hidden-import=module_name my_script.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u52a8\u6001\u5e93\u52a0\u8f7d\u5931\u8d25<\/h4>\n<\/p>\n<p><p>\u67d0\u4e9b\u52a8\u6001\u5e93\u53ef\u80fd\u5728\u8fd0\u884c\u65f6\u65e0\u6cd5\u627e\u5230\uff0c\u8fd9\u901a\u5e38\u662f\u7531\u4e8e\u8def\u5f84\u95ee\u9898\u5f15\u8d77\u7684\u3002\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539.spec\u6587\u4ef6\u4e2d\u7684<code>binaries<\/code>\u9879\u6765\u624b\u52a8\u6dfb\u52a0\u8fd9\u4e9b\u5e93\uff0c\u6216\u8005\u5c06\u5e93\u6587\u4ef6\u590d\u5236\u5230\u53ef\u6267\u884c\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\u4e2d\u3002<\/p>\n<\/p>\n<p><h4>3. \u8de8\u5e73\u53f0\u6253\u5305<\/h4>\n<\/p>\n<p><p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6253\u5305\u5de5\u5177\u901a\u5e38\u53ea\u80fd\u5728\u4e0e\u76ee\u6807\u5e73\u53f0\u76f8\u540c\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u5728Windows\u4e0a\u4f7f\u7528PyInstaller\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\u53ea\u80fd\u5728Windows\u4e0a\u8fd0\u884c\u3002\u5982\u679c\u9700\u8981\u8de8\u5e73\u53f0\u6253\u5305\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528Docker\u6216\u865a\u62df\u673a\u6765\u642d\u5efa\u4e0d\u540c\u7684\u64cd\u4f5c\u7cfb\u7edf\u73af\u5883\u3002<\/p>\n<\/p>\n<p><h3>\u516b\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5c06Python\u6253\u5305\u4e3a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\u662f\u4e00\u9879\u975e\u5e38\u5b9e\u7528\u7684\u6280\u80fd\uff0c\u53ef\u4ee5\u5927\u5927\u7b80\u5316Python\u5e94\u7528\u7684\u5206\u53d1\u548c\u90e8\u7f72\u3002\u901a\u8fc7\u4f7f\u7528PyInstaller\u3001cx_Freeze\u3001py2exe\u7b49\u5de5\u5177\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06Python\u811a\u672c\u53ca\u5176\u4f9d\u8d56\u9879\u6253\u5305\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u5728\u5b9e\u9645\u64cd\u4f5c\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u6253\u5305\u5de5\u5177\uff0c\u5e76\u901a\u8fc7\u8c03\u6574\u914d\u7f6e\u6587\u4ef6\u6765\u5904\u7406\u4f9d\u8d56\u9879\u548c\u6570\u636e\u6587\u4ef6\u3002\u6700\u540e\uff0c\u8bb0\u5f97\u5728\u76ee\u6807\u73af\u5883\u4e2d\u6d4b\u8bd5\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u786e\u4fdd\u5176\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><p>\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff0c\u795d\u4f60\u6210\u529f\u5c06Python\u811a\u672c\u6253\u5305\u4e3a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff01<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5c06Python\u7a0b\u5e8f\u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\uff1f<\/strong><br \/>\u5c06Python\u7a0b\u5e8f\u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u53ef\u4ee5\u4f7f\u7528\u5de5\u5177\u5982PyInstaller\u3001cx_Freeze\u6216py2exe\u3002\u8fd9\u4e9b\u5de5\u5177\u4f1a\u5c06Python\u89e3\u91ca\u5668\u548c\u6240\u6709\u4f9d\u8d56\u7684\u5e93\u6253\u5305\u5230\u4e00\u4e2a\u72ec\u7acb\u7684\u6587\u4ef6\u4e2d\uff0c\u4ece\u800c\u4f7f\u5f97\u7528\u6237\u65e0\u9700\u5b89\u88c5Python\u73af\u5883\u5373\u53ef\u8fd0\u884c\u3002\u5177\u4f53\u6b65\u9aa4\u5305\u62ec\u5b89\u88c5\u76f8\u5e94\u7684\u5de5\u5177\u3001\u914d\u7f6e\u6253\u5305\u9009\u9879\u4ee5\u53ca\u6267\u884c\u6253\u5305\u547d\u4ee4\u3002\u8be6\u7ec6\u7684\u4f7f\u7528\u8bf4\u660e\u53ef\u4ee5\u53c2\u8003\u5404\u5de5\u5177\u7684\u5b98\u65b9\u6587\u6863\u3002<\/p>\n<p><strong>\u6253\u5305\u540e\u7684Python\u7a0b\u5e8f\u5728\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u662f\u5426\u517c\u5bb9\uff1f<\/strong><br \/>\u6253\u5305\u540e\u7684Python\u7a0b\u5e8f\u901a\u5e38\u662f\u9488\u5bf9\u7279\u5b9a\u64cd\u4f5c\u7cfb\u7edf\u7684\u3002\u4f8b\u5982\uff0c\u4f7f\u7528PyInstaller\u5728Windows\u4e0a\u6253\u5305\u7684\u7a0b\u5e8f\uff0c\u901a\u5e38\u65e0\u6cd5\u5728Linux\u6216macOS\u4e0a\u8fd0\u884c\u3002\u56e0\u6b64\uff0c\u5982\u679c\u9700\u8981\u5728\u591a\u4e2a\u5e73\u53f0\u4e0a\u53d1\u5e03\u5e94\u7528\uff0c\u5efa\u8bae\u5206\u522b\u5728\u6bcf\u4e2a\u76ee\u6807\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8fdb\u884c\u6253\u5305\uff0c\u4ee5\u786e\u4fdd\u517c\u5bb9\u6027\u548c\u7a33\u5b9a\u6027\u3002<\/p>\n<p><strong>\u5982\u4f55\u89e3\u51b3\u6253\u5305\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u7684\u4f9d\u8d56\u95ee\u9898\uff1f<\/strong><br \/>\u5728\u6253\u5305Python\u7a0b\u5e8f\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4f9d\u8d56\u7f3a\u5931\u6216\u7248\u672c\u4e0d\u5339\u914d\u7684\u95ee\u9898\u3002\u5efa\u8bae\u5728\u6253\u5305\u4e4b\u524d\uff0c\u786e\u4fdd\u6240\u6709\u4f9d\u8d56\u5e93\u5df2\u6b63\u786e\u5b89\u88c5\uff0c\u5e76\u4e14\u4f7f\u7528requirements.txt\u6587\u4ef6\u6765\u7ba1\u7406\u9879\u76ee\u4f9d\u8d56\u3002\u6253\u5305\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u76f8\u5173\u9009\u9879\u6216\u4f7f\u7528hook\u6587\u4ef6\u6765\u786e\u4fdd\u6240\u6709\u5fc5\u8981\u7684\u4f9d\u8d56\u90fd\u88ab\u5305\u542b\u8fdb\u6765\u3002\u5982\u679c\u9047\u5230\u95ee\u9898\uff0c\u68c0\u67e5\u6253\u5305\u5de5\u5177\u7684\u65e5\u5fd7\u8f93\u51fa\u901a\u5e38\u80fd\u63d0\u4f9b\u6709\u7528\u7684\u8c03\u8bd5\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5c06Python\u6253\u5305\u4e3a\u72ec\u7acb\u7684\u6587\u4ef6\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528PyInstaller\u3001cx_Freeze\u3001py2exe\u7b49\u5de5\u5177\u6765\u5b9e\u73b0 [&hellip;]","protected":false},"author":3,"featured_media":1105423,"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\/1105415"}],"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=1105415"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1105415\/revisions"}],"predecessor-version":[{"id":1105426,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1105415\/revisions\/1105426"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1105423"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1105415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1105415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1105415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}