{"id":1102892,"date":"2025-01-08T16:04:43","date_gmt":"2025-01-08T08:04:43","guid":{"rendered":""},"modified":"2025-01-08T16:04:47","modified_gmt":"2025-01-08T08:04:47","slug":"python64%e4%bd%8d%e5%a6%82%e4%bd%95%e7%94%9f%e6%88%9032%e4%bd%8dexe","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1102892.html","title":{"rendered":"python64\u4f4d\u5982\u4f55\u751f\u621032\u4f4dexe"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25064957\/84203b65-7c47-4ba3-a9c1-191af53cf338.webp\" alt=\"python64\u4f4d\u5982\u4f55\u751f\u621032\u4f4dexe\" \/><\/p>\n<p><p> <strong>Python 64\u4f4d\u5982\u4f55\u751f\u621032\u4f4dexe<\/strong><\/p>\n<\/p>\n<p><p>Python 64\u4f4d\u751f\u621032\u4f4d\u7684exe\u6587\u4ef6\u7684\u6838\u5fc3\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u865a\u62df\u73af\u5883\u3001\u5b89\u88c532\u4f4dPython\u3001\u4f7f\u7528PyInstaller\u3002<strong>\u9996\u5148\u9700\u8981\u5728\u7cfb\u7edf\u4e2d\u5b89\u88c532\u4f4dPython\u7248\u672c<\/strong>\uff0c\u7136\u540e\u5728\u865a\u62df\u73af\u5883\u4e2d\u914d\u7f6e32\u4f4dPython\u73af\u5883\uff0c\u6700\u540e\u4f7f\u7528PyInstaller\u6765\u6253\u5305\u751f\u621032\u4f4d\u7684exe\u6587\u4ef6\u3002\u8fd9\u91cc\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8fd9\u4e09\u79cd\u65b9\u6cd5\u6765\u751f\u621032\u4f4d\u7684exe\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u5b89\u88c532\u4f4dPython<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u751f\u621032\u4f4d\u7684exe\u6587\u4ef6\uff0c\u9700\u8981\u5728\u7cfb\u7edf\u4e0a\u5b89\u88c532\u4f4d\u7684Python\u7248\u672c\u3002\u53ef\u4ee5\u4ece<a href=\"https:\/\/www.python.org\/downloads\/windows\/\">Python\u5b98\u7f51<\/a>\u4e0b\u8f7d32\u4f4d\u7684Python\u5b89\u88c5\u5305\u5e76\u8fdb\u884c\u5b89\u88c5\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u6765\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python -V<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u786e\u4fdd\u663e\u793a\u7684Python\u7248\u672c\u662f32\u4f4d\u7684\uff0c\u4f8b\u5982\uff1aPython 3.x.x [MSC v.1916 32 bit (Intel)]\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u521b\u5efa\u865a\u62df\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u907f\u514d\u5f71\u54cd\u5168\u5c40\u7684Python\u73af\u5883\uff0c\u5efa\u8bae\u4f7f\u7528\u865a\u62df\u73af\u5883\u3002\u53ef\u4ee5\u4f7f\u7528<code>virtualenv<\/code>\u6216\u8005<code>venv<\/code>\u6765\u521b\u5efa\u865a\u62df\u73af\u5883\u3002<\/p>\n<\/p>\n<ol>\n<li>\u9996\u5148\u5b89\u88c5<code>virtualenv<\/code>\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">pip install virtualenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u7136\u540e\u4f7f\u7528<code>virtualenv<\/code>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u865a\u62df\u73af\u5883\uff0c\u5e76\u6307\u5b9a32\u4f4dPython\u7248\u672c\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">virtualenv -p C:\\Path\\To\\32bit\\Python\\python.exe myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u547d\u4ee4\u4e2d\uff0c\u5c06<code>C:\\Path\\To\\32bit\\Python\\python.exe<\/code>\u66ff\u6362\u4e3a32\u4f4dPython\u7684\u5b9e\u9645\u8def\u5f84\u3002<\/p>\n<\/p>\n<ol start=\"3\">\n<li>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\"># Windows<\/p>\n<p>myenv\\Scripts\\activate<\/p>\n<h2><strong>Linux\/MacOS<\/strong><\/h2>\n<p>source myenv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u6240\u6709\u64cd\u4f5c\u90fd\u5c06\u5728\u8be5\u865a\u62df\u73af\u5883\u4e2d\u8fdb\u884c\uff0c\u4e0d\u4f1a\u5f71\u54cd\u5168\u5c40\u7684Python\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u5b89\u88c5PyInstaller<\/h3>\n<\/p>\n<p><p>\u5728\u865a\u62df\u73af\u5883\u4e2d\uff0c\u9700\u8981\u5b89\u88c5<code>PyInstaller<\/code>\u6765\u6253\u5305Python\u811a\u672c\u4e3aexe\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pyinstaller<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528PyInstaller\u6253\u530532\u4f4dexe\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u5728\u865a\u62df\u73af\u5883\u4e2d\uff0c\u901a\u8fc7<code>PyInstaller<\/code>\u6253\u5305Python\u811a\u672c\u4e3a32\u4f4d\u7684exe\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile your_script.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><code>--onefile<\/code>\u9009\u9879\u8868\u793a\u5c06\u6240\u6709\u4f9d\u8d56\u6253\u5305\u5230\u4e00\u4e2aexe\u6587\u4ef6\u4e2d\u3002\u8fd0\u884c\u4e0a\u8ff0\u547d\u4ee4\u540e\uff0c<code>dist<\/code>\u76ee\u5f55\u4e2d\u5c06\u751f\u6210\u4e00\u4e2a32\u4f4d\u7684exe\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u793a\u4f8b\u548c\u6ce8\u610f\u4e8b\u9879<\/h3>\n<\/p>\n<p><h4>1. \u793a\u4f8b<\/h4>\n<\/p>\n<p><p>\u5047\u8bbe\u6709\u4e00\u4e2a\u7b80\u5355\u7684Python\u811a\u672c<code>hello.py<\/code>\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>\u6309\u7167\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u5728\u865a\u62df\u73af\u5883\u4e2d\u8fd0\u884c<code>pyinstaller --onefile hello.py<\/code>\uff0c\u6700\u7ec8\u4f1a\u5728<code>dist<\/code>\u76ee\u5f55\u4e2d\u751f\u6210\u4e00\u4e2a<code>hello.exe<\/code>\u6587\u4ef6\u3002\u53cc\u51fb\u8fd0\u884c\u8be5\u6587\u4ef6\uff0c\u5c06\u4f1a\u5728\u547d\u4ee4\u884c\u7a97\u53e3\u4e2d\u770b\u5230\u201cHello, World!\u201d\u7684\u8f93\u51fa\u3002<\/p>\n<\/p>\n<p><h4>2. \u6ce8\u610f\u4e8b\u9879<\/h4>\n<\/p>\n<ul>\n<li><strong>\u4f9d\u8d56\u7ba1\u7406<\/strong>\uff1a\u786e\u4fdd\u5728\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5\u4e86\u6240\u6709\u811a\u672c\u6240\u9700\u7684\u4f9d\u8d56\u3002\u53ef\u4ee5\u4f7f\u7528<code>pip freeze &gt; requirements.txt<\/code>\u6765\u5bfc\u51fa\u4f9d\u8d56\uff0c\u5e76\u4f7f\u7528<code>pip install -r requirements.txt<\/code>\u6765\u5b89\u88c5\u4f9d\u8d56\u3002<\/li>\n<li><strong>\u517c\u5bb9\u6027<\/strong>\uff1a\u786e\u4fdd\u811a\u672c\u572832\u4f4dPython\u73af\u5883\u4e2d\u80fd\u591f\u6b63\u5e38\u8fd0\u884c\u3002\u67d0\u4e9b\u5e93\u53ef\u80fd\u4ec5\u652f\u630164\u4f4d\u6216\u7279\u5b9a\u7248\u672c\u7684Python\uff0c\u9700\u8fdb\u884c\u517c\u5bb9\u6027\u6d4b\u8bd5\u3002<\/li>\n<li><strong>\u8def\u5f84\u95ee\u9898<\/strong>\uff1a\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u8def\u5f84\u4e2d\u4e0d\u8981\u5305\u542b\u7a7a\u683c\u6216\u7279\u6b8a\u5b57\u7b26\uff0c\u4ee5\u514d\u5f71\u54cd\u865a\u62df\u73af\u5883\u7684\u521b\u5efa\u548c\u6fc0\u6d3b\u3002<\/li>\n<\/ul>\n<p><h3>\u516d\u3001\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6cd5<\/h3>\n<\/p>\n<p><h4>1. \u6253\u5305\u5931\u8d25<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u5728\u6253\u5305\u8fc7\u7a0b\u4e2d\u9047\u5230\u9519\u8bef\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>\u68c0\u67e5\u4f9d\u8d56<\/strong>\uff1a\u786e\u4fdd\u6240\u6709\u4f9d\u8d56\u5e93\u5df2\u6b63\u786e\u5b89\u88c5\u3002<\/li>\n<li><strong>\u66f4\u65b0PyInstaller<\/strong>\uff1a\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684<code>PyInstaller<\/code>\uff0c\u53ef\u80fd\u4fee\u590d\u4e00\u4e9b\u5df2\u77e5\u7684\u9519\u8bef\u3002<\/li>\n<li><strong>\u6e05\u7406\u7f13\u5b58<\/strong>\uff1a\u5220\u9664<code>build<\/code>\u548c<code>dist<\/code>\u76ee\u5f55\uff0c\u91cd\u65b0\u8fd0\u884c\u6253\u5305\u547d\u4ee4\u3002<\/li>\n<\/ul>\n<p><h4>2. exe\u6587\u4ef6\u8fd0\u884c\u9519\u8bef<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u751f\u6210\u7684exe\u6587\u4ef6\u5728\u8fd0\u884c\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>\u68c0\u67e5\u65e5\u5fd7<\/strong>\uff1a<code>PyInstaller<\/code>\u751f\u6210\u7684\u65e5\u5fd7\u6587\u4ef6\u53ef\u4ee5\u5e2e\u52a9\u5b9a\u4f4d\u95ee\u9898\u6240\u5728\u3002<\/li>\n<li><strong>\u4f9d\u8d56\u5e93\u95ee\u9898<\/strong>\uff1a\u67d0\u4e9b\u4f9d\u8d56\u5e93\u53ef\u80fd\u5728exe\u6587\u4ef6\u4e2d\u672a\u6b63\u786e\u6253\u5305\uff0c\u9700\u624b\u52a8\u6dfb\u52a0\u8fd9\u4e9b\u5e93\u3002<\/li>\n<\/ul>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u5b89\u88c532\u4f4dPython\u7248\u672c\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883\u548cPyInstaller\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06Python\u811a\u672c\u6253\u5305\u4e3a32\u4f4d\u7684exe\u6587\u4ef6\u3002\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4ec5\u907f\u514d\u4e86\u5bf9\u5168\u5c40\u73af\u5883\u7684\u5f71\u54cd\uff0c\u8fd8\u80fd\u786e\u4fdd\u751f\u6210\u7684exe\u6587\u4ef6\u572832\u4f4d\u7cfb\u7edf\u4e0a\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u516b\u3001\u8fdb\u4e00\u6b65\u4f18\u5316\u548c\u9ad8\u7ea7\u6280\u5de7<\/h3>\n<\/p>\n<p><h4>1. \u4f7f\u7528spec\u6587\u4ef6\u8fdb\u884c\u9ad8\u7ea7\u914d\u7f6e<\/h4>\n<\/p>\n<p><p>PyInstaller\u7684\u9ed8\u8ba4\u914d\u7f6e\u53ef\u80fd\u65e0\u6cd5\u6ee1\u8db3\u6240\u6709\u9700\u6c42\uff0c\u6b64\u65f6\u53ef\u4ee5\u4f7f\u7528spec\u6587\u4ef6\u8fdb\u884c\u66f4\u9ad8\u7ea7\u7684\u914d\u7f6e\u3002spec\u6587\u4ef6\u662f\u4e00\u4e2aPython\u811a\u672c\uff0c\u5b9a\u4e49\u4e86\u6253\u5305\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<\/p>\n<ol>\n<li>\u751f\u6210spec\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile --name my_app --specpath . your_script.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u751f\u6210\u4e00\u4e2a\u540d\u4e3a<code>your_script.spec<\/code>\u7684\u6587\u4ef6\u3002<\/p>\n<\/p>\n<ol start=\"2\">\n<li>\u7f16\u8f91spec\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-python\"># your_script.spec<\/p>\n<h2><strong>-*- mode: python -*-<\/strong><\/h2>\n<p>block_cipher = None<\/p>\n<p>a = Analysis(<\/p>\n<p>    [&#39;your_script.py&#39;],<\/p>\n<p>    pathex=[&#39;\/path\/to\/your\/script&#39;],<\/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>    noarchive=False,<\/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>    [],<\/p>\n<p>    exclude_binaries=True,<\/p>\n<p>    name=&#39;my_app&#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>    console=True,<\/p>\n<p>    disable_windowed_traceback=False,<\/p>\n<p>    target_arch=&quot;x86&quot;,  # \u6307\u5b9a\u76ee\u6807\u67b6\u6784\u4e3a32\u4f4d<\/p>\n<p>)<\/p>\n<p>coll = COLLECT(<\/p>\n<p>    exe,<\/p>\n<p>    a.binaries,<\/p>\n<p>    a.zipfiles,<\/p>\n<p>    a.datas,<\/p>\n<p>    strip=False,<\/p>\n<p>    upx=True,<\/p>\n<p>    upx_exclude=[],<\/p>\n<p>    name=&#39;my_app&#39;,<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li>\u4f7f\u7528spec\u6587\u4ef6\u6253\u5305\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">pyinstaller your_script.spec<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u6dfb\u52a0\u56fe\u6807\u548c\u7248\u672c\u4fe1\u606f<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u5728spec\u6587\u4ef6\u4e2d\u6307\u5b9aexe\u6587\u4ef6\u7684\u56fe\u6807\u548c\u7248\u672c\u4fe1\u606f\uff0c\u4f7f\u751f\u6210\u7684exe\u6587\u4ef6\u66f4\u52a0\u4e13\u4e1a\u3002<\/p>\n<\/p>\n<ol>\n<li>\u6dfb\u52a0\u56fe\u6807\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-python\">exe = EXE(<\/p>\n<p>    pyz,<\/p>\n<p>    a.scripts,<\/p>\n<p>    [],<\/p>\n<p>    exclude_binaries=True,<\/p>\n<p>    name=&#39;my_app&#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>    console=True,<\/p>\n<p>    disable_windowed_traceback=False,<\/p>\n<p>    icon=&#39;path\/to\/icon.ico&#39;,  # \u6dfb\u52a0\u56fe\u6807\u8def\u5f84<\/p>\n<p>    target_arch=&quot;x86&quot;,<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u6dfb\u52a0\u7248\u672c\u4fe1\u606f\uff1a<\/li>\n<\/ol>\n<p><p>\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a<code>version.txt<\/code>\u6587\u4ef6\uff0c\u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<p><pre><code># UTF-8<\/p>\n<p>#<\/p>\n<h2><strong>For more det<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>ls about fixed file info &#39;ffi&#39; see:<\/strong><\/h2>\n<h2><strong>https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/menurc\/vs-versioninfo<\/strong><\/h2>\n<p>VSVersionInfo(<\/p>\n<p>  ffi=FixedFileInfo(<\/p>\n<p>    filevers=(1, 0, 0, 0),<\/p>\n<p>    prodvers=(1, 0, 0, 0),<\/p>\n<p>    mask=0x3f,<\/p>\n<p>    flags=0x0,<\/p>\n<p>    OS=0x40004,<\/p>\n<p>    fileType=0x1,<\/p>\n<p>    subtype=0x0,<\/p>\n<p>    date=(0, 0)<\/p>\n<p>  ),<\/p>\n<p>  kids=[<\/p>\n<p>    StringFileInfo(<\/p>\n<p>      [<\/p>\n<p>        StringTable(<\/p>\n<p>          &#39;040904B0&#39;,<\/p>\n<p>          [<\/p>\n<p>            StringStruct(&#39;CompanyName&#39;, &#39;My Company&#39;),<\/p>\n<p>            StringStruct(&#39;FileDescription&#39;, &#39;My Application&#39;),<\/p>\n<p>            StringStruct(&#39;FileVersion&#39;, &#39;1.0.0.0&#39;),<\/p>\n<p>            StringStruct(&#39;InternalName&#39;, &#39;my_app&#39;),<\/p>\n<p>            StringStruct(&#39;LegalCopyright&#39;, &#39;\u00a9 My Company 2023&#39;),<\/p>\n<p>            StringStruct(&#39;OriginalFilename&#39;, &#39;my_app.exe&#39;),<\/p>\n<p>            StringStruct(&#39;ProductName&#39;, &#39;My Product&#39;),<\/p>\n<p>            StringStruct(&#39;ProductVersion&#39;, &#39;1.0.0.0&#39;),<\/p>\n<p>          ]<\/p>\n<p>        )<\/p>\n<p>      ]<\/p>\n<p>    ),<\/p>\n<p>    VarFileInfo([VarStruct(&#39;Translation&#39;, [1033, 1200])])<\/p>\n<p>  ]<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728spec\u6587\u4ef6\u4e2d\u6dfb\u52a0\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">exe = EXE(<\/p>\n<p>    pyz,<\/p>\n<p>    a.scripts,<\/p>\n<p>    [],<\/p>\n<p>    exclude_binaries=True,<\/p>\n<p>    name=&#39;my_app&#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>    console=True,<\/p>\n<p>    disable_windowed_traceback=False,<\/p>\n<p>    icon=&#39;path\/to\/icon.ico&#39;,<\/p>\n<p>    version=&#39;version.txt&#39;,  # \u6dfb\u52a0\u7248\u672c\u4fe1\u606f<\/p>\n<p>    target_arch=&quot;x86&quot;,<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u65b9\u6cd5\uff0c\u53ef\u4ee5\u8fdb\u4e00\u6b65\u4f18\u5316\u751f\u6210\u7684exe\u6587\u4ef6\uff0c\u4f7f\u5176\u66f4\u52a0\u4e13\u4e1a\u548c\u6613\u7528\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u5c0664\u4f4d\u7a0b\u5e8f\u8f6c\u6362\u4e3a32\u4f4dEXE\u6587\u4ef6\uff1f<\/strong><br \/>\u8981\u5c0664\u4f4dPython\u7a0b\u5e8f\u8f6c\u6362\u4e3a32\u4f4dEXE\u6587\u4ef6\uff0c\u60a8\u9700\u8981\u4f7f\u7528\u7279\u5b9a\u7684\u6253\u5305\u5de5\u5177\uff0c\u5982PyInstaller\u6216cx_Freeze\u3002\u8fd9\u4e9b\u5de5\u5177\u80fd\u591f\u8bc6\u522b\u5e76\u5904\u7406\u60a8\u6240\u9700\u7684Python\u7248\u672c\uff0c\u786e\u4fdd\u751f\u6210\u7684EXE\u6587\u4ef6\u80fd\u591f\u572832\u4f4d\u7cfb\u7edf\u4e0a\u8fd0\u884c\u3002\u786e\u4fdd\u572832\u4f4dPython\u73af\u5883\u4e2d\u8fd0\u884c\u8fd9\u4e9b\u5de5\u5177\uff0c\u4ee5\u4fbf\u751f\u6210\u9002\u5f53\u7684\u6587\u4ef6\u683c\u5f0f\u3002<\/p>\n<p><strong>\u5728\u751f\u621032\u4f4dEXE\u65f6\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u5e93\u7684\u517c\u5bb9\u6027\uff1f<\/strong><br \/>\u5728\u6253\u5305\u5e94\u7528\u7a0b\u5e8f\u4e4b\u524d\uff0c\u68c0\u67e5\u60a8\u4f7f\u7528\u7684\u6240\u6709\u7b2c\u4e09\u65b9\u5e93\u662f\u5426\u670932\u4f4d\u7248\u672c\u3002\u67d0\u4e9b\u5e93\u53ef\u80fd\u4ec5\u652f\u630164\u4f4d\uff0c\u6216\u8005\u572832\u4f4d\u73af\u5883\u4e2d\u5b58\u5728\u7279\u5b9a\u7684\u517c\u5bb9\u6027\u95ee\u9898\u3002\u5efa\u8bae\u572832\u4f4dPython\u73af\u5883\u4e2d\u6d4b\u8bd5\u60a8\u7684\u7a0b\u5e8f\uff0c\u786e\u4fdd\u6240\u6709\u529f\u80fd\u6b63\u5e38\u8fd0\u884c\uff0c\u7136\u540e\u518d\u8fdb\u884c\u6253\u5305\u3002<\/p>\n<p><strong>\u662f\u5426\u53ef\u4ee5\u76f4\u63a5\u572864\u4f4d\u7cfb\u7edf\u4e0a\u751f\u621032\u4f4dEXE\u6587\u4ef6\uff1f<\/strong><br \/>\u76f4\u63a5\u572864\u4f4d\u7cfb\u7edf\u4e0a\u751f\u621032\u4f4dEXE\u6587\u4ef6\u662f\u53ef\u80fd\u7684\uff0c\u4f46\u524d\u63d0\u662f\u60a8\u9700\u8981\u5b89\u88c532\u4f4d\u7248\u672c\u7684Python\u53ca\u5176\u76f8\u5e94\u7684\u5e93\u548c\u4f9d\u8d56\u9879\u3002\u4f7f\u7528\u5408\u9002\u7684\u6253\u5305\u5de5\u5177\uff0c\u5e76\u786e\u4fdd\u572832\u4f4d\u73af\u5883\u4e2d\u6267\u884c\u6253\u5305\u547d\u4ee4\uff0c\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u6f5c\u5728\u7684\u517c\u5bb9\u6027\u95ee\u9898\u3002<\/p>\n<p><strong>\u751f\u6210\u768432\u4f4dEXE\u6587\u4ef6\u5728\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u662f\u5426\u517c\u5bb9\uff1f<\/strong><br \/>\u751f\u6210\u768432\u4f4dEXE\u6587\u4ef6\u901a\u5e38\u53ef\u4ee5\u572832\u4f4d\u548c64\u4f4d\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8fd0\u884c\uff0c\u4f46\u7279\u5b9a\u7684\u4f9d\u8d56\u9879\u548c\u7cfb\u7edf\u73af\u5883\u53ef\u80fd\u4f1a\u5f71\u54cd\u5176\u517c\u5bb9\u6027\u3002\u5728\u76ee\u6807\u7cfb\u7edf\u4e0a\u8fdb\u884c\u5145\u5206\u6d4b\u8bd5\u975e\u5e38\u91cd\u8981\uff0c\u4ee5\u786e\u4fdd\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u80fd\u591f\u987a\u5229\u8fd0\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python 64\u4f4d\u5982\u4f55\u751f\u621032\u4f4dexe Python 64\u4f4d\u751f\u621032\u4f4d\u7684exe\u6587\u4ef6\u7684\u6838\u5fc3\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u865a\u62df\u73af [&hellip;]","protected":false},"author":3,"featured_media":1102906,"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\/1102892"}],"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=1102892"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1102892\/revisions"}],"predecessor-version":[{"id":1102908,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1102892\/revisions\/1102908"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1102906"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1102892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1102892"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1102892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}