{"id":1121768,"date":"2025-01-08T19:13:14","date_gmt":"2025-01-08T11:13:14","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1121768.html"},"modified":"2025-01-08T19:13:17","modified_gmt":"2025-01-08T11:13:17","slug":"%e5%a6%82%e4%bd%95%e5%b0%86%e4%b8%80%e4%b8%aapython%e7%a8%8b%e5%ba%8f%e6%89%93%e5%8c%85","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1121768.html","title":{"rendered":"\u5982\u4f55\u5c06\u4e00\u4e2apython\u7a0b\u5e8f\u6253\u5305"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25083859\/9045d132-a431-4862-84d4-5330a5b2eefb.webp\" alt=\"\u5982\u4f55\u5c06\u4e00\u4e2apython\u7a0b\u5e8f\u6253\u5305\" \/><\/p>\n<p><p> <strong>\u5c06\u4e00\u4e2aPython\u7a0b\u5e8f\u6253\u5305\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u4f46\u6838\u5fc3\u6b65\u9aa4\u5305\u62ec\u51c6\u5907\u73af\u5883\u3001\u9009\u62e9\u6253\u5305\u5de5\u5177\u3001\u914d\u7f6e\u6253\u5305\u5de5\u5177\u3001\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3001\u6d4b\u8bd5\u548c\u5206\u53d1\u3002<\/strong> \u5176\u4e2d\u9009\u62e9\u5408\u9002\u7684\u6253\u5305\u5de5\u5177\u662f\u6700\u5173\u952e\u7684\u4e00\u6b65\u3002\u5e38\u7528\u7684\u5de5\u5177\u5305\u62ecPyInstaller\u3001cx_Freeze\u548cpy2exe\u7b49\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528PyInstaller\u6765\u6253\u5305Python\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u51c6\u5907\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u6253\u5305Python\u7a0b\u5e8f\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5f00\u53d1\u73af\u5883\u548c\u4f9d\u8d56\u5e93\u90fd\u5df2\u6b63\u786e\u914d\u7f6e\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u51c6\u5907\u5de5\u4f5c\u7684\u5efa\u8bae\uff1a<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5Python\u548cpip<\/h4>\n<\/p>\n<p><p>\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u548cpip\u3002\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u6765\u68c0\u67e5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p>pip --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u672a\u5b89\u88c5\uff0c\u53ef\u4ee5\u4ecePython\u5b98\u7f51\uff08python.org\uff09\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><h4>2. \u521b\u5efa\u865a\u62df\u73af\u5883<\/h4>\n<\/p>\n<p><p>\u521b\u5efa\u4e00\u4e2a\u865a\u62df\u73af\u5883\u6709\u52a9\u4e8e\u7ba1\u7406\u9879\u76ee\u4f9d\u8d56\uff0c\u5e76\u907f\u514d\u4e0e\u5176\u4ed6\u9879\u76ee\u7684\u4f9d\u8d56\u51b2\u7a81\u3002\u4f7f\u7528<code>venv<\/code>\u6a21\u5757\u53ef\u4ee5\u8f7b\u677e\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python -m venv myenv<\/p>\n<p>source myenv\/bin\/activate  # Windows \u7528\u6237\u4f7f\u7528 myenv\\Scripts\\activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u5b89\u88c5\u9879\u76ee\u4f9d\u8d56<\/h4>\n<\/p>\n<p><p>\u5728\u865a\u62df\u73af\u5883\u4e2d\uff0c\u4f7f\u7528pip\u5b89\u88c5\u6240\u6709\u9879\u76ee\u6240\u9700\u7684\u4f9d\u8d56\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install -r requirements.txt<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u9009\u62e9\u6253\u5305\u5de5\u5177<\/h3>\n<\/p>\n<p><p>\u5e02\u9762\u4e0a\u6709\u591a\u79cdPython\u6253\u5305\u5de5\u5177\uff0c\u6bcf\u79cd\u5de5\u5177\u90fd\u6709\u5176\u7279\u70b9\u548c\u9002\u7528\u573a\u666f\u3002\u4ee5\u4e0b\u662f\u51e0\u79cd\u5e38\u89c1\u7684\u6253\u5305\u5de5\u5177\uff1a<\/p>\n<\/p>\n<p><h4>1. PyInstaller<\/h4>\n<\/p>\n<p><p>PyInstaller \u662f\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684\u6253\u5305\u5de5\u5177\uff0c\u652f\u6301\u591a\u4e2a\u64cd\u4f5c\u7cfb\u7edf\uff08Windows\u3001Linux\u3001MacOS\uff09\uff0c\u5e76\u4e14\u53ef\u4ee5\u5c06Python\u811a\u672c\u6253\u5305\u6210\u5355\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h4>2. cx_Freeze<\/h4>\n<\/p>\n<p><p>cx_Freeze \u662f\u53e6\u4e00\u4e2a\u6d41\u884c\u7684\u9009\u62e9\uff0c\u652f\u6301Windows\u548cLinux\uff0c\u9002\u7528\u4e8e\u751f\u6210\u8f83\u5c0f\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h4>3. py2exe<\/h4>\n<\/p>\n<p><p>py2exe \u4e3b\u8981\u9488\u5bf9Windows\u64cd\u4f5c\u7cfb\u7edf\uff0c\u53ef\u4ee5\u5c06Python\u7a0b\u5e8f\u6253\u5305\u6210Windows\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u5b89\u88c5\u548c\u914d\u7f6e\u6253\u5305\u5de5\u5177<\/h3>\n<\/p>\n<p><p>\u672c\u6587\u5c06\u4ee5PyInstaller\u4e3a\u4f8b\uff0c\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8be5\u5de5\u5177\u5c06Python\u7a0b\u5e8f\u6253\u5305\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5PyInstaller<\/h4>\n<\/p>\n<p><p>\u5728\u865a\u62df\u73af\u5883\u4e2d\uff0c\u4f7f\u7528pip\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><h4>2. \u914d\u7f6ePyInstaller<\/h4>\n<\/p>\n<p><p>PyInstaller\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u53c2\u6570\u6216.spec\u6587\u4ef6\u8fdb\u884c\u914d\u7f6e\u3002\u4ee5\u4e0b\u662f\u5e38\u7528\u7684\u914d\u7f6e\u9009\u9879\uff1a<\/p>\n<\/p>\n<ul>\n<li><code>--onefile<\/code>\uff1a\u5c06\u6240\u6709\u6587\u4ef6\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/li>\n<li><code>--noconsole<\/code>\uff1a\u4e0d\u663e\u793a\u63a7\u5236\u53f0\u7a97\u53e3\uff0c\u9002\u7528\u4e8eGUI\u5e94\u7528\u7a0b\u5e8f\u3002<\/li>\n<li><code>--icon<\/code>\uff1a\u6307\u5b9a\u53ef\u6267\u884c\u6587\u4ef6\u7684\u56fe\u6807\u3002<\/li>\n<\/ul>\n<p><h3>\u56db\u3001\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6<\/h3>\n<\/p>\n<p><h4>1. \u57fa\u672c\u547d\u4ee4<\/h4>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile --noconsole --icon=myicon.ico myscript.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6761\u547d\u4ee4\u5c06\u751f\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5e76\u4e14\u4e0d\u663e\u793a\u63a7\u5236\u53f0\u7a97\u53e3\u3002<\/p>\n<\/p>\n<p><h4>2. \u4f7f\u7528.spec\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>.spec\u6587\u4ef6\u53ef\u4ee5\u63d0\u4f9b\u66f4\u590d\u6742\u7684\u914d\u7f6e\u3002\u901a\u8fc7<code>pyinstaller myscript.py<\/code>\u751f\u6210\u521d\u59cb\u7684.spec\u6587\u4ef6\uff0c\u7136\u540e\u53ef\u4ee5\u8fdb\u884c\u7f16\u8f91\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># myscript.spec<\/p>\n<h2><strong>-*- mode: python ; coding: utf-8 -*-<\/strong><\/h2>\n<p>block_cipher = None<\/p>\n<p>a = Analysis(<\/p>\n<p>    [&#39;myscript.py&#39;],<\/p>\n<p>    pathex=[],<\/p>\n<p>    binaries=[],<\/p>\n<p>    datas=[],<\/p>\n<p>    hiddenimports=[],<\/p>\n<p>    hookspath=[],<\/p>\n<p>    runtime_hooks=[],<\/p>\n<p>    excludes=[],<\/p>\n<p>    win_no_prefer_redirects=False,<\/p>\n<p>    win_private_assemblies=False,<\/p>\n<p>    cipher=block_cipher,<\/p>\n<p>)<\/p>\n<p>pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)<\/p>\n<p>exe = EXE(<\/p>\n<p>    pyz,<\/p>\n<p>    a.scripts,<\/p>\n<p>    a.binaries,<\/p>\n<p>    a.zipfiles,<\/p>\n<p>    a.datas,<\/p>\n<p>    [],<\/p>\n<p>    name=&#39;myscript&#39;,<\/p>\n<p>    debug=False,<\/p>\n<p>    bootloader_ignore_signals=False,<\/p>\n<p>    strip=False,<\/p>\n<p>    upx=True,<\/p>\n<p>    upx_exclude=[],<\/p>\n<p>    runtime_tmpdir=None,<\/p>\n<p>    console=False,<\/p>\n<p>    icon=&#39;myicon.ico&#39;,<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller myscript.spec<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u6d4b\u8bd5\u548c\u5206\u53d1<\/h3>\n<\/p>\n<p><p>\u6253\u5305\u5b8c\u6210\u540e\uff0c\u9700\u8981\u8fdb\u884c\u6d4b\u8bd5\u4ee5\u786e\u4fdd\u53ef\u6267\u884c\u6587\u4ef6\u7684\u529f\u80fd\u6b63\u5e38\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5efa\u8bae\uff1a<\/p>\n<\/p>\n<p><h4>1. \u672c\u5730\u6d4b\u8bd5<\/h4>\n<\/p>\n<p><p>\u5728\u672c\u5730\u8fd0\u884c\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u68c0\u67e5\u662f\u5426\u6709\u9519\u8bef\u6216\u9057\u6f0f\u7684\u4f9d\u8d56\u3002<\/p>\n<\/p>\n<p><h4>2. \u6d4b\u8bd5\u73af\u5883<\/h4>\n<\/p>\n<p><p>\u5728\u4e0d\u540c\u7684\u64cd\u4f5c\u7cfb\u7edf\u548c\u73af\u5883\u4e0b\u6d4b\u8bd5\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u786e\u4fdd\u5176\u517c\u5bb9\u6027\u3002<\/p>\n<\/p>\n<p><h4>3. \u5206\u53d1<\/h4>\n<\/p>\n<p><p>\u5c06\u53ef\u6267\u884c\u6587\u4ef6\u5206\u53d1\u7ed9\u7528\u6237\uff0c\u53ef\u4ee5\u9009\u62e9\u4e0a\u4f20\u5230GitHub\u3001Google Drive\u6216\u4f7f\u7528\u5176\u4ed6\u5206\u53d1\u5e73\u53f0\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u5e38\u89c1\u95ee\u9898\u548c\u89e3\u51b3\u65b9\u6848<\/h3>\n<\/p>\n<p><h4>1. \u7f3a\u5c11\u4f9d\u8d56<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u5728\u8fd0\u884c\u53ef\u6267\u884c\u6587\u4ef6\u65f6\u51fa\u73b0\u7f3a\u5c11\u4f9d\u8d56\u7684\u9519\u8bef\uff0c\u53ef\u4ee5\u5728.spec\u6587\u4ef6\u4e2d\u6dfb\u52a0\u7f3a\u5c11\u7684\u4f9d\u8d56\uff0c\u6216\u4f7f\u7528<code>hiddenimports<\/code>\u53c2\u6570\u3002<\/p>\n<\/p>\n<p><h4>2. \u6587\u4ef6\u5927\u5c0f\u8fc7\u5927<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528UPX\uff08Ultimate Packer for eXecutables\uff09\u538b\u7f29\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u4ee5\u51cf\u5c0f\u6587\u4ef6\u5927\u5c0f\u3002<\/p>\n<\/p>\n<p><h4>3. \u517c\u5bb9\u6027\u95ee\u9898<\/h4>\n<\/p>\n<p><p>\u786e\u4fdd\u6253\u5305\u73af\u5883\u4e0e\u76ee\u6807\u8fd0\u884c\u73af\u5883\u4e00\u81f4\u3002\u4f8b\u5982\uff0c\u5982\u679c\u8981\u6253\u5305Windows\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e94\u5728Windows\u7cfb\u7edf\u4e0a\u8fdb\u884c\u6253\u5305\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u4f18\u5316\u4e0e\u9ad8\u7ea7\u6280\u5de7<\/h3>\n<\/p>\n<p><h4>1. \u4f7f\u7528\u591a\u7ebf\u7a0b\u548c\u591a\u8fdb\u7a0b<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u7684\u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u66f4\u9ad8\u7684\u6027\u80fd\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528\u591a\u7ebf\u7a0b\u6216\u591a\u8fdb\u7a0b\u6280\u672f\u3002<\/p>\n<\/p>\n<p><h4>2. \u52a0\u5bc6\u548c\u4fdd\u62a4\u4ee3\u7801<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528\u4ee3\u7801\u6df7\u6dc6\u5de5\u5177\u6216\u52a0\u5bc6\u65b9\u6cd5\u4fdd\u62a4\u4f60\u7684Python\u4ee3\u7801\uff0c\u9632\u6b62\u53cd\u7f16\u8bd1\u3002<\/p>\n<\/p>\n<p><h4>3. \u81ea\u52a8\u5316\u6253\u5305\u6d41\u7a0b<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<a href=\"https:\/\/docs.pingcode.com\/blog\/devops\/52691.html\" target=\"_blank\">CI\/CD<\/a>\u5de5\u5177\uff08\u5982Jenkins\u3001GitHub Actions\uff09\u81ea\u52a8\u5316\u6253\u5305\u548c\u5206\u53d1\u6d41\u7a0b\uff0c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<\/p>\n<p><h3>\u516b\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u6253\u5305Python\u7a0b\u5e8f\u662f\u5c06\u5f00\u53d1\u6210\u679c\u8f6c\u5316\u4e3a\u53ef\u5206\u53d1\u8f6f\u4ef6\u7684\u91cd\u8981\u4e00\u6b65\u3002\u901a\u8fc7\u9009\u62e9\u5408\u9002\u7684\u5de5\u5177\uff08\u5982PyInstaller\uff09\u3001\u914d\u7f6e\u6253\u5305\u53c2\u6570\u3001\u751f\u6210\u548c\u6d4b\u8bd5\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u53ef\u4ee5\u786e\u4fdd\u4f60\u7684\u7a0b\u5e8f\u5728\u4e0d\u540c\u73af\u5883\u4e0b\u6b63\u5e38\u8fd0\u884c\u3002\u5e0c\u671b\u672c\u6587\u63d0\u4f9b\u7684\u8be6\u7ec6\u6b65\u9aa4\u548c\u5efa\u8bae\u80fd\u5e2e\u52a9\u4f60\u987a\u5229\u5b8c\u6210Python\u7a0b\u5e8f\u7684\u6253\u5305\u4efb\u52a1\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684\u6253\u5305\u5de5\u5177\u6765\u6253\u5305\u6211\u7684Python\u7a0b\u5e8f\uff1f<\/strong><br \/>\u9009\u62e9\u6253\u5305\u5de5\u5177\u65f6\uff0c\u9700\u8981\u8003\u8651\u591a\u4e2a\u56e0\u7d20\u3002\u5e38\u89c1\u7684\u5de5\u5177\u5305\u62ecPyInstaller\u3001cx_Freeze\u548cpy2exe\u7b49\u3002PyInstaller\u652f\u6301\u591a\u79cd\u5e73\u53f0\uff0c\u80fd\u591f\u5c06Python\u7a0b\u5e8f\u6253\u5305\u6210\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u9002\u5408\u5927\u591a\u6570\u7528\u6237\u3002cx_Freeze\u540c\u6837\u652f\u6301\u8de8\u5e73\u53f0\uff0c\u4f46\u66f4\u9002\u5408\u9700\u8981\u521b\u5efa\u5b89\u88c5\u7a0b\u5e8f\u7684\u5e94\u7528\u3002py2exe\u4e3b\u8981\u9488\u5bf9Windows\u7528\u6237\uff0c\u9002\u5408\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3aWindows\u53ef\u6267\u884c\u6587\u4ef6\u3002\u6839\u636e\u4f60\u7684\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u6709\u6548\u63d0\u9ad8\u6253\u5305\u6548\u7387\u3002<\/p>\n<p><strong>\u6253\u5305\u540e\u7684Python\u7a0b\u5e8f\u5728\u5176\u4ed6\u8ba1\u7b97\u673a\u4e0a\u80fd\u5426\u6b63\u5e38\u8fd0\u884c\uff1f<\/strong><br \/>\u6253\u5305\u540e\u7684Python\u7a0b\u5e8f\u4e00\u822c\u53ef\u4ee5\u5728\u6ca1\u6709Python\u73af\u5883\u7684\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u3002\u6253\u5305\u5de5\u5177\u4f1a\u5c06\u6240\u9700\u7684Python\u89e3\u91ca\u5668\u548c\u4f9d\u8d56\u5e93\u4e00\u5e76\u6253\u5305\uff0c\u56e0\u6b64\u7528\u6237\u65e0\u9700\u5728\u76ee\u6807\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5Python\u3002\u4e0d\u8fc7\uff0c\u786e\u4fdd\u76ee\u6807\u8ba1\u7b97\u673a\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e0e\u6253\u5305\u65f6\u9009\u62e9\u7684\u67b6\u6784\u4e00\u81f4\uff0c\u6bd4\u598232\u4f4d\u621664\u4f4d\u3002\u6b64\u5916\uff0c\u67d0\u4e9b\u7a0b\u5e8f\u53ef\u80fd\u4f9d\u8d56\u4e8e\u7279\u5b9a\u7684\u5916\u90e8\u8d44\u6e90\u6216\u6587\u4ef6\uff0c\u8fd9\u4e9b\u4e5f\u9700\u8981\u4e00\u5e76\u5904\u7406\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728\u6253\u5305\u8fc7\u7a0b\u4e2d\u5904\u7406\u5916\u90e8\u4f9d\u8d56\u548c\u8d44\u6e90\u6587\u4ef6\uff1f<\/strong><br \/>\u5728\u6253\u5305Python\u7a0b\u5e8f\u65f6\uff0c\u5916\u90e8\u4f9d\u8d56\u548c\u8d44\u6e90\u6587\u4ef6\u7684\u5904\u7406\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u5927\u591a\u6570\u6253\u5305\u5de5\u5177\u63d0\u4f9b\u4e86\u914d\u7f6e\u9009\u9879\uff0c\u5141\u8bb8\u4f60\u6307\u5b9a\u8981\u5305\u62ec\u7684\u989d\u5916\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u4f7f\u7528PyInstaller\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7.spec\u6587\u4ef6\u4e2d\u7684datas\u53c2\u6570\u6765\u6dfb\u52a0\u8d44\u6e90\u6587\u4ef6\uff0c\u786e\u4fdd\u5728\u6253\u5305\u65f6\u5c06\u5176\u5305\u542b\u5728\u5185\u3002\u5bf9\u4e8e\u4f9d\u8d56\u5e93\uff0c\u786e\u4fdd\u5728\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5\u6240\u6709\u5fc5\u8981\u7684\u5e93\uff0c\u6253\u5305\u5de5\u5177\u901a\u5e38\u4f1a\u81ea\u52a8\u68c0\u6d4b\u5e76\u5305\u542b\u5b83\u4eec\u3002\u6d4b\u8bd5\u6253\u5305\u540e\u7684\u7a0b\u5e8f\u4ee5\u786e\u8ba4\u6240\u6709\u529f\u80fd\u6b63\u5e38\u662f\u5341\u5206\u5fc5\u8981\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5c06\u4e00\u4e2aPython\u7a0b\u5e8f\u6253\u5305\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u4f46\u6838\u5fc3\u6b65\u9aa4\u5305\u62ec\u51c6\u5907\u73af\u5883\u3001\u9009\u62e9\u6253\u5305\u5de5\u5177\u3001\u914d\u7f6e\u6253\u5305\u5de5\u5177\u3001\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3001\u6d4b [&hellip;]","protected":false},"author":3,"featured_media":1121772,"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\/1121768"}],"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=1121768"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1121768\/revisions"}],"predecessor-version":[{"id":1121775,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1121768\/revisions\/1121775"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1121772"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1121768"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1121768"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1121768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}