{"id":1027689,"date":"2024-12-31T10:53:02","date_gmt":"2024-12-31T02:53:02","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1027689.html"},"modified":"2024-12-31T10:53:05","modified_gmt":"2024-12-31T02:53:05","slug":"python%e5%a6%82%e4%bd%95%e7%bc%96%e8%af%91%e6%88%90%e6%9c%ac%e5%9c%b0%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1027689.html","title":{"rendered":"python\u5982\u4f55\u7f16\u8bd1\u6210\u672c\u5730\u4ee3\u7801"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/12\/d86f9644-6594-4665-b1b4-32d4dcb5eed7.webp?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"python\u5982\u4f55\u7f16\u8bd1\u6210\u672c\u5730\u4ee3\u7801\" \/><\/p>\n<p><p> <strong>Python\u7f16\u8bd1\u6210\u672c\u5730\u4ee3\u7801\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528Cython\u3001Nuitka\u3001PyInstaller\u3001\u4ee5\u53caPy2exe\u7b49\u3002\u8fd9\u4e9b\u5de5\u5177\u80fd\u591f\u5c06Python\u4ee3\u7801\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u7684\u672c\u5730\u4ee3\u7801\uff0c\u4ece\u800c\u63d0\u9ad8\u6027\u80fd\u3001\u4fdd\u62a4\u4ee3\u7801\u548c\u7b80\u5316\u90e8\u7f72\u3002<\/strong> \u5176\u4e2d\uff0c<strong>Cython<\/strong> \u662f\u5c06Python\u4ee3\u7801\u8f6c\u6362\u4e3aC\u4ee3\u7801\u5e76\u8fdb\u884c\u7f16\u8bd1\u7684\u5de5\u5177\uff0c\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4e0b\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528Cython\u7f16\u8bd1Python\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>Cython\u662f\u4e00\u4e2a\u5c06Python\u4ee3\u7801\u7f16\u8bd1\u6210C\u8bed\u8a00\u6269\u5c55\u6a21\u5757\u7684\u5de5\u5177\u3002\u901a\u8fc7\u5c06Python\u4ee3\u7801\u7f16\u8bd1\u6210C\u4ee3\u7801\uff0cCython\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u4ee3\u7801\u7684\u6267\u884c\u901f\u5ea6\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528Cython\u5c06Python\u4ee3\u7801\u7f16\u8bd1\u6210\u672c\u5730\u4ee3\u7801\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u5b89\u88c5Cython<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u5b89\u88c5Cython\u5e93\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528pip\u6765\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install cython<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u521b\u5efaCython\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u5c06\u4f60\u7684Python\u4ee3\u7801\u4fdd\u5b58\u4e3a<code>.pyx<\/code>\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a\u540d\u4e3a<code>example.py<\/code>\u7684Python\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u5c06\u5176\u5185\u5bb9\u590d\u5236\u5230\u4e00\u4e2a\u540d\u4e3a<code>example.pyx<\/code>\u7684\u6587\u4ef6\u4e2d\u3002<\/p>\n<\/p>\n<p><h4>3\u3001\u7f16\u5199setup.py\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u4e3a\u4e86\u7f16\u8bd1Cython\u6587\u4ef6\uff0c\u4f60\u9700\u8981\u7f16\u5199\u4e00\u4e2a<code>setup.py<\/code>\u6587\u4ef6\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684<code>setup.py<\/code>\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from setuptools import setup<\/p>\n<p>from Cython.Build import cythonize<\/p>\n<p>setup(<\/p>\n<p>    ext_modules = cythonize(&quot;example.pyx&quot;)<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4\u3001\u7f16\u8bd1Cython\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u7f16\u8bd1Cython\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python setup.py build_ext --inplace<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u751f\u6210\u4e00\u4e2a\u4e0e<code>example.pyx<\/code>\u5bf9\u5e94\u7684\u5171\u4eab\u5bf9\u8c61\u6587\u4ef6\uff08\u4f8b\u5982\uff0c<code>example.cpython-38-x86_64-linux-gnu.so<\/code>\uff09\uff0c\u4f60\u53ef\u4ee5\u50cf\u4f7f\u7528\u666e\u901aPython\u6a21\u5757\u4e00\u6837\u5bfc\u5165\u548c\u4f7f\u7528\u5b83\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528Nuitka\u7f16\u8bd1Python\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>Nuitka\u662f\u53e6\u4e00\u79cd\u5c06Python\u4ee3\u7801\u7f16\u8bd1\u6210C\u8bed\u8a00\u7684\u5de5\u5177\uff0c\u652f\u6301\u751f\u6210\u672c\u5730\u53ef\u6267\u884c\u6587\u4ef6\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528Nuitka\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u5b89\u88c5Nuitka<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u5b89\u88c5Nuitka\u5e93\u53ca\u5176\u4f9d\u8d56\u9879\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install nuitka<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u7f16\u8bd1Python\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a\u540d\u4e3a<code>example.py<\/code>\u7684Python\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528Nuitka\u5c06\u5176\u7f16\u8bd1\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">nuitka --standalone --onefile --plugin-enable=pylint-warnings example.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u751f\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5305\u542b\u6240\u6709\u4f9d\u8d56\u9879\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528PyInstaller\u6253\u5305Python\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>PyInstaller\u662f\u4e00\u79cd\u5c06Python\u7a0b\u5e8f\u6253\u5305\u6210\u72ec\u7acb\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5de5\u5177\uff0c\u9002\u7528\u4e8eWindows\u3001Mac\u548cLinux\u5e73\u53f0\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528PyInstaller\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u5b89\u88c5PyInstaller<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u5b89\u88c5PyInstaller\u5e93\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\u3001\u6253\u5305Python\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a\u540d\u4e3a<code>example.py<\/code>\u7684Python\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528PyInstaller\u5c06\u5176\u6253\u5305\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile example.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u751f\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5305\u542b\u6240\u6709\u4f9d\u8d56\u9879\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528Py2exe\u7f16\u8bd1Python\u4ee3\u7801\uff08\u4ec5\u9002\u7528\u4e8eWindows\uff09<\/h3>\n<\/p>\n<p><p>Py2exe\u662f\u4e00\u79cd\u5c06Python\u4ee3\u7801\u8f6c\u6362\u4e3aWindows\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5de5\u5177\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528Py2exe\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u5b89\u88c5Py2exe<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u5b89\u88c5Py2exe\u5e93\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\u3001\u7f16\u5199setup.py\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u4e3a\u4e86\u4f7f\u7528Py2exe\uff0c\u4f60\u9700\u8981\u7f16\u5199\u4e00\u4e2a<code>setup.py<\/code>\u6587\u4ef6\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684<code>setup.py<\/code>\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(console=[&#39;example.py&#39;])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u7f16\u8bd1Python\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u7f16\u8bd1Python\u6587\u4ef6\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\u751f\u6210\u4e00\u4e2aWindows\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5305\u542b\u6240\u6709\u4f9d\u8d56\u9879\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u6bd4\u8f83\u4e0e\u9009\u62e9<\/h3>\n<\/p>\n<p><p>\u4e0d\u540c\u7684\u5de5\u5177\u6709\u4e0d\u540c\u7684\u7279\u70b9\u548c\u9002\u7528\u573a\u666f\u3002\u4ee5\u4e0b\u662f\u5bf9\u4e0a\u8ff0\u5de5\u5177\u7684\u7b80\u5355\u6bd4\u8f83\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u6027\u80fd<\/h4>\n<\/p>\n<p><p><strong>Cython<\/strong> \u548c <strong>Nuitka<\/strong> \u90fd\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8Python\u4ee3\u7801\u7684\u6267\u884c\u901f\u5ea6\u3002Cython\u901a\u8fc7\u5c06Python\u4ee3\u7801\u8f6c\u6362\u4e3aC\u4ee3\u7801\u5e76\u8fdb\u884c\u7f16\u8bd1\uff0c\u800cNuitka\u5219\u5c06Python\u4ee3\u7801\u76f4\u63a5\u7f16\u8bd1\u4e3a\u672c\u5730\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u6613\u7528\u6027<\/h4>\n<\/p>\n<p><p><strong>PyInstaller<\/strong> \u548c <strong>Py2exe<\/strong> \u66f4\u4fa7\u91cd\u4e8e\u5c06Python\u7a0b\u5e8f\u6253\u5305\u6210\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u9002\u5408\u9700\u8981\u5c06Python\u5e94\u7528\u7a0b\u5e8f\u5206\u53d1\u7ed9\u5176\u4ed6\u7528\u6237\u7684\u573a\u666f\u3002PyInstaller\u652f\u6301\u591a\u5e73\u53f0\uff0c\u800cPy2exe\u4ec5\u9002\u7528\u4e8eWindows\u3002<\/p>\n<\/p>\n<p><h4>3\u3001\u517c\u5bb9\u6027<\/h4>\n<\/p>\n<p><p><strong>Cython<\/strong> \u548c <strong>Nuitka<\/strong> \u5bf9\u4e8e\u7eafPython\u4ee3\u7801\u6709\u5f88\u597d\u7684\u517c\u5bb9\u6027\uff0c\u4f46\u5bf9\u4e8e\u4f9d\u8d56\u4e8eC\u6269\u5c55\u7684\u5e93\u53ef\u80fd\u9700\u8981\u989d\u5916\u7684\u914d\u7f6e\u3002<strong>PyInstaller<\/strong> \u548c <strong>Py2exe<\/strong> \u5219\u80fd\u591f\u66f4\u597d\u5730\u5904\u7406\u5305\u542bC\u6269\u5c55\u7684\u5e93\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u5b9e\u8df5\u793a\u4f8b<\/h3>\n<\/p>\n<p><h4>1\u3001\u4f7f\u7528Cython\u7f16\u8bd1Python\u4ee3\u7801\u793a\u4f8b<\/h4>\n<\/p>\n<p><p>\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a\u7b80\u5355\u7684Python\u51fd\u6570\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def fib(n):<\/p>\n<p>    if n &lt;= 2:<\/p>\n<p>        return 1<\/p>\n<p>    return fib(n-1) + fib(n-2)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5c06\u5176\u4fdd\u5b58\u4e3a<code>fib.pyx<\/code>\uff0c\u7136\u540e\u4f7f\u7528\u4ee5\u4e0b<code>setup.py<\/code>\u6587\u4ef6\u7f16\u8bd1\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from setuptools import setup<\/p>\n<p>from Cython.Build import cythonize<\/p>\n<p>setup(<\/p>\n<p>    ext_modules = cythonize(&quot;fib.pyx&quot;)<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python setup.py build_ext --inplace<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u751f\u6210\u4e00\u4e2a\u5171\u4eab\u5bf9\u8c61\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u5728Python\u4e2d\u5bfc\u5165\u5e76\u4f7f\u7528\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from fib import fib<\/p>\n<p>print(fib(10))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u4f7f\u7528Nuitka\u7f16\u8bd1Python\u4ee3\u7801\u793a\u4f8b<\/h4>\n<\/p>\n<p><p>\u5047\u8bbe\u4f60\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>\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">nuitka --standalone --onefile hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u751f\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u8fd0\u884c\u8be5\u6587\u4ef6\u5c06\u8f93\u51fa&quot;Hello, World!&quot;\u3002<\/p>\n<\/p>\n<p><h4>3\u3001\u4f7f\u7528PyInstaller\u6253\u5305Python\u4ee3\u7801\u793a\u4f8b<\/h4>\n<\/p>\n<p><p>\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a\u7b80\u5355\u7684Python\u811a\u672c<code>app.py<\/code>\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;This is a standalone application!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyinstaller --onefile app.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u751f\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u8fd0\u884c\u8be5\u6587\u4ef6\u5c06\u8f93\u51fa&quot;This is a standalone application!&quot;\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5c06Python\u4ee3\u7801\u7f16\u8bd1\u6210\u672c\u5730\u4ee3\u7801\u53ef\u4ee5\u63d0\u9ad8\u6027\u80fd\u3001\u4fdd\u62a4\u4ee3\u7801\u548c\u7b80\u5316\u90e8\u7f72\u3002<strong>Cython<\/strong> \u548c <strong>Nuitka<\/strong> \u662f\u4e24\u79cd\u5e38\u7528\u7684\u7f16\u8bd1\u5de5\u5177\uff0c\u5b83\u4eec\u901a\u8fc7\u5c06Python\u4ee3\u7801\u8f6c\u6362\u4e3aC\u4ee3\u7801\u6216\u76f4\u63a5\u7f16\u8bd1\u4e3a\u672c\u5730\u4ee3\u7801\u6765\u63d0\u9ad8\u6027\u80fd\u3002<strong>PyInstaller<\/strong> \u548c <strong>Py2exe<\/strong> \u5219\u66f4\u4fa7\u91cd\u4e8e\u5c06Python\u7a0b\u5e8f\u6253\u5305\u6210\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u9002\u5408\u9700\u8981\u5206\u53d1\u5e94\u7528\u7a0b\u5e8f\u7684\u573a\u666f\u3002\u6839\u636e\u4f60\u7684\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u6709\u6548\u63d0\u5347Python\u9879\u76ee\u7684\u6027\u80fd\u548c\u53ef\u79fb\u690d\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5c06Python\u4ee3\u7801\u7f16\u8bd1\u4e3a\u672c\u5730\u53ef\u6267\u884c\u6587\u4ef6\uff1f<\/strong><br \/>\u8981\u5c06Python\u4ee3\u7801\u7f16\u8bd1\u4e3a\u672c\u5730\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u5de5\u5177\u5982PyInstaller\u3001cx_Freeze\u6216py2exe\u3002\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u5c06\u60a8\u7684Python\u811a\u672c\u6253\u5305\u6210\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u4ece\u800c\u4f7f\u5176\u5728\u6ca1\u6709Python\u73af\u5883\u7684\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u3002\u5b89\u88c5\u8fd9\u4e9b\u5de5\u5177\u540e\uff0c\u4f7f\u7528\u547d\u4ee4\u884c\u8f93\u5165\u76f8\u5e94\u7684\u547d\u4ee4\u5373\u53ef\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u4f7f\u7528PyInstaller\u65f6\uff0c\u60a8\u53ef\u4ee5\u8fd0\u884c<code>pyinstaller your_script.py<\/code>\uff0c\u5b83\u5c06\u751f\u6210\u4e00\u4e2a\u540d\u4e3a\u201cdist\u201d\u7684\u6587\u4ef6\u5939\uff0c\u5176\u4e2d\u5305\u542b\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p><strong>\u7f16\u8bd1Python\u4ee3\u7801\u540e\uff0c\u662f\u5426\u4f1a\u5f71\u54cd\u4ee3\u7801\u7684\u6027\u80fd\uff1f<\/strong><br \/>\u7f16\u8bd1\u540e\uff0cPython\u4ee3\u7801\u7684\u6027\u80fd\u53ef\u80fd\u4f1a\u6709\u6240\u53d8\u5316\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u6240\u4f7f\u7528\u7684\u7f16\u8bd1\u5de5\u5177\u548c\u4ee3\u7801\u7684\u590d\u6742\u6027\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u5c06Python\u4ee3\u7801\u7f16\u8bd1\u4e3a\u672c\u5730\u53ef\u6267\u884c\u6587\u4ef6\u53ef\u80fd\u4f1a\u63d0\u9ad8\u542f\u52a8\u901f\u5ea6\uff0c\u56e0\u4e3a\u4ee3\u7801\u5728\u8fd0\u884c\u65f6\u4e0d\u9700\u8981\u89e3\u91ca\u3002\u4f46\u5728\u8fd0\u884c\u65f6\u7684\u6027\u80fd\u63d0\u5347\u901a\u5e38\u6709\u9650\uff0c\u7279\u522b\u662f\u5bf9\u4e8e\u90a3\u4e9b\u5728Python\u4e2d\u4f9d\u8d56\u52a8\u6001\u7279\u6027\u6216\u5927\u91cf\u5e93\u7684\u9879\u76ee\u3002<\/p>\n<p><strong>\u7f16\u8bd1\u540e\u7684Python\u7a0b\u5e8f\u5982\u4f55\u786e\u4fdd\u5728\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u517c\u5bb9\uff1f<\/strong><br \/>\u4e3a\u4e86\u786e\u4fdd\u7f16\u8bd1\u540e\u7684Python\u7a0b\u5e8f\u5728\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u517c\u5bb9\uff0c\u5efa\u8bae\u4f7f\u7528\u8de8\u5e73\u53f0\u7684\u7f16\u8bd1\u5de5\u5177\uff0c\u5982PyInstaller\u6216cx_Freeze\u3002\u60a8\u9700\u8981\u5728\u6bcf\u4e2a\u76ee\u6807\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5206\u522b\u7f16\u8bd1\u4ee3\u7801\uff0c\u56e0\u4e3a\u7f16\u8bd1\u7684\u53ef\u6267\u884c\u6587\u4ef6\u901a\u5e38\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u7684\u67b6\u6784\u76f8\u5173\u3002\u6b64\u5916\uff0c\u786e\u4fdd\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u7684\u5e73\u53f0\u65e0\u5173\u7684\u5e93\u548c\u529f\u80fd\uff0c\u8fd9\u6837\u53ef\u4ee5\u63d0\u9ad8\u8de8\u5e73\u53f0\u8fd0\u884c\u7684\u6210\u529f\u7387\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u7f16\u8bd1\u6210\u672c\u5730\u4ee3\u7801\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528Cython\u3001Nuitka\u3001PyInstaller\u3001\u4ee5\u53caPy2 [&hellip;]","protected":false},"author":3,"featured_media":1027699,"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\/1027689"}],"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=1027689"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1027689\/revisions"}],"predecessor-version":[{"id":1027706,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1027689\/revisions\/1027706"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1027699"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1027689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1027689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1027689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}