{"id":952885,"date":"2024-12-27T01:37:19","date_gmt":"2024-12-26T17:37:19","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/952885.html"},"modified":"2024-12-27T01:37:21","modified_gmt":"2024-12-26T17:37:21","slug":"python%e5%a6%82%e4%bd%95%e5%8f%91%e5%b8%83pyc","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/952885.html","title":{"rendered":"python\u5982\u4f55\u53d1\u5e03pyc"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25090547\/10e1fbb4-7171-4cc7-80f2-3ffd0ca10162.webp\" alt=\"python\u5982\u4f55\u53d1\u5e03pyc\" \/><\/p>\n<p><p> <strong>\u8981\u53d1\u5e03 <code>.pyc<\/code> \u6587\u4ef6\uff0c\u9996\u5148\u9700\u8981\u7406\u89e3\u5b83\u4eec\u662f Python \u7f16\u8bd1\u5668\u751f\u6210\u7684\u5b57\u8282\u7801\u6587\u4ef6\uff0c\u901a\u5e38\u4e0d\u5efa\u8bae\u5355\u72ec\u53d1\u5e03 <code>.pyc<\/code> \u6587\u4ef6\uff0c\u56e0\u4e3a\u5b83\u4eec\u4e0e\u7279\u5b9a\u7684 Python \u7248\u672c\u7ed1\u5b9a\uff0c\u4e0d\u6613\u79fb\u690d\u3002\u5efa\u8bae\u53d1\u5e03 <code>.py<\/code> \u6e90\u6587\u4ef6\u3001\u5fc5\u8981\u65f6\u4f7f\u7528\u6253\u5305\u5de5\u5177\u3001\u4f7f\u7528 Cython \u6216\u5176\u4ed6\u5de5\u5177\u7f16\u8bd1\u4e3a\u4e8c\u8fdb\u5236\u683c\u5f0f\u3002<\/strong><\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u7406\u89e3 <code>.pyc<\/code> \u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u5728\u5f00\u59cb\u63a2\u8ba8\u5982\u4f55\u53d1\u5e03 <code>.pyc<\/code> \u6587\u4ef6\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u4e86\u89e3 <code>.pyc<\/code> \u6587\u4ef6\u7684\u6027\u8d28\u548c\u7528\u9014\u3002<code>.pyc<\/code> \u6587\u4ef6\u662f Python \u89e3\u91ca\u5668\u5c06 <code>.py<\/code> \u6e90\u6587\u4ef6\u7f16\u8bd1\u540e\u7684\u5b57\u8282\u7801\u6587\u4ef6\u3002\u5b83\u4eec\u901a\u5e38\u5b58\u50a8\u5728 <code>__pycache__<\/code> \u76ee\u5f55\u4e2d\uff0c\u5e76\u4e14\u5305\u542b\u4e86 Python \u7248\u672c\u7684\u6807\u8bc6\u3002<code>.pyc<\/code> \u6587\u4ef6\u5b58\u5728\u7684\u4e3b\u8981\u76ee\u7684\u662f\u63d0\u9ad8\u6a21\u5757\u52a0\u8f7d\u7684\u901f\u5ea6\uff0c\u56e0\u4e3a\u5b57\u8282\u7801\u6bd4\u6e90\u4ee3\u7801\u66f4\u5feb\u5730\u88ab\u89e3\u91ca\u5668\u6267\u884c\u3002<\/p>\n<\/p>\n<p><p>\u7531\u4e8e <code>.pyc<\/code> \u6587\u4ef6\u4e0e\u7279\u5b9a\u7684 Python \u7248\u672c\u7ed1\u5b9a\uff0c\u56e0\u6b64\u5b83\u4eec\u4e0d\u5177\u6709\u826f\u597d\u7684\u79fb\u690d\u6027\u3002\u5982\u679c\u4f60\u5e0c\u671b\u5206\u4eab\u4f60\u7684 Python \u4ee3\u7801\uff0c\u901a\u5e38\u5efa\u8bae\u53d1\u5e03\u6e90\u4ee3\u7801\u6587\u4ef6 <code>.py<\/code>\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4ee3\u7801\u80fd\u591f\u5728\u4e0d\u540c\u7684 Python \u7248\u672c\u548c\u5e73\u53f0\u4e0a\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u53d1\u5e03 <code>.pyc<\/code> \u6587\u4ef6\u7684\u539f\u56e0<\/h3>\n<\/p>\n<p><p>\u5c3d\u7ba1\u53d1\u5e03 <code>.pyc<\/code> \u6587\u4ef6\u4e0d\u5e38\u89c1\uff0c\u4f46\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f60\u53ef\u80fd\u5e0c\u671b\u8fd9\u6837\u505a\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4fdd\u62a4\u6e90\u4ee3\u7801<\/strong>\uff1a\u6709\u65f6\u5019\uff0c\u5f00\u53d1\u8005\u5e0c\u671b\u4fdd\u62a4\u4ed6\u4eec\u7684\u6e90\u4ee3\u7801\u4e0d\u88ab\u76f4\u63a5\u8bbf\u95ee\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u53d1\u5e03 <code>.pyc<\/code> \u6587\u4ef6\u6765\u907f\u514d\u76f4\u63a5\u66b4\u9732\u6e90\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6027\u80fd\u4f18\u5316<\/strong>\uff1a\u5728\u67d0\u4e9b\u73af\u5883\u4e2d\uff0c\u76f4\u63a5\u4f7f\u7528 <code>.pyc<\/code> \u6587\u4ef6\u53ef\u80fd\u4f1a\u7a0d\u5fae\u51cf\u5c11\u52a0\u8f7d\u65f6\u95f4\uff0c\u56e0\u4e3a\u4e0d\u9700\u8981\u91cd\u65b0\u7f16\u8bd1\u5b57\u8282\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u7136\u800c\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u8fd9\u4e9b\u4f18\u52bf\u901a\u5e38\u662f\u6709\u9650\u7684\uff0c\u5e76\u4e14\u53ef\u80fd\u5b58\u5728\u517c\u5bb9\u6027\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u51c6\u5907\u53d1\u5e03 <code>.pyc<\/code> \u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u5728\u51b3\u5b9a\u53d1\u5e03 <code>.pyc<\/code> \u6587\u4ef6\u4e4b\u524d\uff0c\u4f60\u9700\u8981\u786e\u4fdd\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Python \u7248\u672c\u517c\u5bb9\u6027<\/strong>\uff1a\u56e0\u4e3a <code>.pyc<\/code> \u6587\u4ef6\u4e0e\u751f\u6210\u5b83\u4eec\u7684 Python \u7248\u672c\u7d27\u5bc6\u76f8\u5173\uff0c\u4f60\u9700\u8981\u786e\u5b9a\u76ee\u6807\u73af\u5883\u7684 Python \u7248\u672c\u4e0e\u751f\u6210 <code>.pyc<\/code> \u6587\u4ef6\u7684\u7248\u672c\u4e00\u81f4\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u786e\u4fdd\u6b63\u786e\u7684\u6253\u5305\u5de5\u5177<\/strong>\uff1a\u4f7f\u7528\u6253\u5305\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u4f60\u7ba1\u7406 <code>.pyc<\/code> \u6587\u4ef6\u7684\u5206\u53d1\u3002Python \u63d0\u4f9b\u4e86\u4e00\u4e9b\u5185\u7f6e\u7684\u5de5\u5177\uff0c\u6bd4\u5982 <code>setuptools<\/code> \u548c <code>distutils<\/code>\uff0c\u5b83\u4eec\u53ef\u4ee5\u5e2e\u52a9\u4f60\u8f7b\u677e\u5730\u6253\u5305\u548c\u5206\u53d1 Python \u9879\u76ee\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u4f7f\u7528\u6253\u5305\u5de5\u5177\u53d1\u5e03 <code>.pyc<\/code> \u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u6253\u5305\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u4f60\u521b\u5efa\u4e00\u4e2a\u5305\u542b <code>.pyc<\/code> \u6587\u4ef6\u7684\u53ef\u5206\u53d1\u5305\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u6b65\u9aa4\u548c\u5de5\u5177\uff0c\u5e2e\u52a9\u4f60\u5b8c\u6210\u8fd9\u4e2a\u8fc7\u7a0b\uff1a<\/p>\n<\/p>\n<p><h4>1. <code>setuptools<\/code> \u548c <code>distutils<\/code><\/h4>\n<\/p>\n<p><p>\u8fd9\u4e9b\u5de5\u5177\u662f Python \u63d0\u4f9b\u7684\u6807\u51c6\u6253\u5305\u5de5\u5177\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u521b\u5efa\u6e90\u5206\u53d1\u5305\u548c\u4e8c\u8fdb\u5236\u5206\u53d1\u5305\u3002\u4f60\u53ef\u4ee5\u5728 <code>setup.py<\/code> \u6587\u4ef6\u4e2d\u6307\u5b9a\u9700\u8981\u5305\u542b\u7684\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from setuptools import setup, find_packages<\/p>\n<p>setup(<\/p>\n<p>    name=&#39;your_package_name&#39;,<\/p>\n<p>    version=&#39;1.0&#39;,<\/p>\n<p>    packages=find_packages(),<\/p>\n<p>    include_package_data=True,<\/p>\n<p>    data_files=[(&#39;your_package&#39;, [&#39;path\/to\/your_file.pyc&#39;])],<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c<code>data_files<\/code> \u53c2\u6570\u7528\u4e8e\u6307\u5b9a\u9700\u8981\u5305\u542b\u7684 <code>.pyc<\/code> \u6587\u4ef6\u3002\u8fd0\u884c <code>python setup.py sdist<\/code> \u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u6e90\u5206\u53d1\u5305\u3002<\/p>\n<\/p>\n<p><h4>2. \u4f7f\u7528 <code>py_compile<\/code> \u6a21\u5757<\/h4>\n<\/p>\n<p><p>\u5728\u53d1\u5e03 <code>.pyc<\/code> \u6587\u4ef6\u4e4b\u524d\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u7f16\u8bd1\u4f60\u7684 <code>.py<\/code> \u6587\u4ef6\u3002Python \u63d0\u4f9b\u4e86 <code>py_compile<\/code> \u6a21\u5757\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5b8c\u6210\u8fd9\u4e2a\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import py_compile<\/p>\n<p>py_compile.compile(&#39;your_script.py&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u751f\u6210 <code>your_script.cpython-&lt;version&gt;.pyc<\/code> \u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u5c06\u5b83\u79fb\u52a8\u5230\u4f60\u7684\u5305\u7ed3\u6784\u4e2d\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u4f7f\u7528 Cython \u7f16\u8bd1\u4e3a\u4e8c\u8fdb\u5236\u683c\u5f0f<\/h3>\n<\/p>\n<p><p><strong>Cython<\/strong> \u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5c06\u4f60\u7684 Python \u4ee3\u7801\u7f16\u8bd1\u4e3a C \u6269\u5c55\u6a21\u5757\uff0c\u8fd9\u6837\u4e0d\u4ec5\u4fdd\u62a4\u4e86\u6e90\u4ee3\u7801\uff0c\u8fd8\u53ef\u80fd\u63d0\u5347\u6267\u884c\u6548\u7387\u3002\u4f7f\u7528 Cython \u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><h4>1. \u7f16\u5199 <code>setup.py<\/code><\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u4e3a\u4f60\u7684\u9879\u76ee\u521b\u5efa\u4e00\u4e2a <code>setup.py<\/code> \u6587\u4ef6\uff0c\u6307\u5b9a\u9700\u8981\u7f16\u8bd1\u7684 <code>.py<\/code> \u6587\u4ef6\u3002<\/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>    name=&#39;your_package&#39;,<\/p>\n<p>    ext_modules=cythonize(&quot;your_script.py&quot;),<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u7f16\u8bd1\u4ee3\u7801<\/h4>\n<\/p>\n<p><p>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u7f16\u8bd1\u4ee3\u7801\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 <code>.so<\/code> \u6587\u4ef6\uff08\u5728 Unix \u7cfb\u7edf\u4e0a\uff09\u6216 <code>.pyd<\/code> \u6587\u4ef6\uff08\u5728 Windows \u7cfb\u7edf\u4e0a\uff09\uff0c\u8fd9\u4e9b\u6587\u4ef6\u53ef\u4ee5\u88ab\u89c6\u4e3a\u4e8c\u8fdb\u5236\u683c\u5f0f\u7684\u6a21\u5757\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u4f7f\u7528 Docker \u53d1\u5e03 <code>.pyc<\/code> \u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u7684\u9879\u76ee\u9700\u8981\u5728\u7279\u5b9a\u7684\u73af\u5883\u4e2d\u8fd0\u884c\uff0c\u4f7f\u7528 Docker \u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\u3002\u901a\u8fc7 Docker\uff0c\u4f60\u53ef\u4ee5\u6253\u5305\u4f60\u7684\u5e94\u7528\u7a0b\u5e8f\u548c\u6240\u6709\u7684\u4f9d\u8d56\u9879\uff0c\u5305\u62ec <code>.pyc<\/code> \u6587\u4ef6\uff0c\u5728\u4e00\u4e2a\u5bb9\u5668\u4e2d\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h4>1. \u521b\u5efa Dockerfile<\/h4>\n<\/p>\n<p><p>\u7f16\u5199\u4e00\u4e2a <code>Dockerfile<\/code>\uff0c\u5305\u542b\u4f60\u7684\u5e94\u7528\u7a0b\u5e8f\u548c\u6240\u6709\u5fc5\u8981\u7684\u4f9d\u8d56\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-dockerfile\">FROM python:3.x<\/p>\n<p>COPY . \/app<\/p>\n<p>WORKDIR \/app<\/p>\n<p>RUN python -m compileall .<\/p>\n<p>CMD [&quot;python&quot;, &quot;your_script.pyc&quot;]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u6784\u5efa\u548c\u8fd0\u884c Docker \u955c\u50cf<\/h4>\n<\/p>\n<p><p>\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u6784\u5efa\u548c\u8fd0\u884c\u4f60\u7684 Docker \u955c\u50cf\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">docker build -t your_image_name .<\/p>\n<p>docker run your_image_name<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e03\u3001\u6ce8\u610f\u4e8b\u9879<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u517c\u5bb9\u6027\u95ee\u9898<\/strong>\uff1a\u53d1\u5e03 <code>.pyc<\/code> \u6587\u4ef6\u65f6\u4e00\u5b9a\u8981\u6ce8\u610f\u76ee\u6807\u73af\u5883\u7684 Python \u7248\u672c\u517c\u5bb9\u6027\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u5168\u6027<\/strong>\uff1a\u867d\u7136 <code>.pyc<\/code> \u6587\u4ef6\u4e0d\u76f4\u63a5\u66b4\u9732\u6e90\u4ee3\u7801\uff0c\u4f46\u5b83\u4eec\u4f9d\u7136\u53ef\u4ee5\u88ab\u53cd\u7f16\u8bd1\uff0c\u4e0d\u80fd\u4f5c\u4e3a\u552f\u4e00\u7684\u5b89\u5168\u63aa\u65bd\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6027\u80fd\u63d0\u5347\u6709\u9650<\/strong>\uff1a\u867d\u7136 <code>.pyc<\/code> \u6587\u4ef6\u53ef\u4ee5\u7565\u5fae\u63d0\u9ad8\u52a0\u8f7d\u901f\u5ea6\uff0c\u4f46\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u8fd9\u79cd\u63d0\u5347\u662f\u5fae\u4e0d\u8db3\u9053\u7684\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u63a8\u8350\u53d1\u5e03\u6e90\u4ee3\u7801<\/strong>\uff1a\u5982\u679c\u6ca1\u6709\u7279\u522b\u7684\u7406\u7531\uff0c\u63a8\u8350\u53d1\u5e03\u6e90\u4ee3\u7801\u4ee5\u786e\u4fdd\u4ee3\u7801\u7684\u53ef\u79fb\u690d\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u5728\u9700\u8981\u65f6\u53d1\u5e03\u548c\u7ba1\u7406 <code>.pyc<\/code> \u6587\u4ef6\u3002\u7136\u800c\uff0c\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u53d1\u5e03\u6e90\u4ee3\u7801\u6216\u4f7f\u7528 Cython \u7f16\u8bd1\u4e3a\u4e8c\u8fdb\u5236\u683c\u5f0f\u662f\u66f4\u597d\u7684\u9009\u62e9\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5c06Python\u9879\u76ee\u6253\u5305\u4e3apyc\u6587\u4ef6\uff1f<\/strong><br \/>\u5c06Python\u9879\u76ee\u6253\u5305\u4e3apyc\u6587\u4ef6\u901a\u5e38\u6d89\u53ca\u4f7f\u7528Python\u81ea\u5e26\u7684\u7f16\u8bd1\u529f\u80fd\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528<code>py_compile<\/code>\u6a21\u5757\u6216<code>compileall<\/code>\u6a21\u5757\u6765\u81ea\u52a8\u7f16\u8bd1\u9879\u76ee\u4e2d\u7684\u6240\u6709.py\u6587\u4ef6\u3002\u4f7f\u7528\u547d\u4ee4\u884c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5b8c\u6210\u8fd9\u4e00\u8fc7\u7a0b\uff0c\u53ea\u9700\u5728\u9879\u76ee\u76ee\u5f55\u4e2d\u8fd0\u884c<code>python -m compileall .<\/code>\uff0c\u5b83\u4f1a\u5c06\u6240\u6709\u7684.py\u6587\u4ef6\u7f16\u8bd1\u4e3a\u76f8\u5e94\u7684.pyo\u6216.pyc\u6587\u4ef6\u3002<\/p>\n<p><strong>pyc\u6587\u4ef6\u6709\u4ec0\u4e48\u4f18\u52bf\uff1f<\/strong><br \/>pyc\u6587\u4ef6\u662f\u7ecf\u8fc7\u7f16\u8bd1\u7684Python\u6587\u4ef6\uff0c\u4e3b\u8981\u4f18\u52bf\u5728\u4e8e\u5b83\u4eec\u63d0\u9ad8\u4e86\u7a0b\u5e8f\u7684\u542f\u52a8\u901f\u5ea6\u3002\u56e0\u4e3apyc\u6587\u4ef6\u5df2\u7ecf\u88ab\u7f16\u8bd1\u4e3a\u5b57\u8282\u7801\uff0c\u6240\u4ee5\u5728\u8fd0\u884c\u65f6\uff0cPython\u89e3\u91ca\u5668\u53ef\u4ee5\u76f4\u63a5\u52a0\u8f7d\u8fd9\u4e9b\u6587\u4ef6\uff0c\u800c\u4e0d\u9700\u8981\u91cd\u65b0\u7f16\u8bd1\u6e90\u4ee3\u7801\u3002\u6b64\u5916\uff0cpyc\u6587\u4ef6\u8fd8\u53ef\u4ee5\u5e2e\u52a9\u4fdd\u62a4\u6e90\u4ee3\u7801\uff0c\u867d\u7136\u5b83\u4eec\u5e76\u4e0d\u662f\u771f\u6b63\u7684\u201c\u5b89\u5168\u201d\uff0c\u4f46\u53ef\u4ee5\u4f7f\u4ee3\u7801\u66f4\u96be\u4ee5\u9605\u8bfb\u3002<\/p>\n<p><strong>\u5982\u4f55\u7ba1\u7406\u548c\u5206\u53d1pyc\u6587\u4ef6\uff1f<\/strong><br \/>\u5728\u5206\u53d1pyc\u6587\u4ef6\u65f6\uff0c\u786e\u4fdd\u76ee\u6807\u7cfb\u7edf\u7684Python\u7248\u672c\u4e0e\u7f16\u8bd1\u5b83\u4eec\u7684\u7248\u672c\u76f8\u540c\uff0c\u56e0\u4e3apyc\u6587\u4ef6\u662f\u4e0e\u7279\u5b9a\u7248\u672c\u7684Python\u89e3\u91ca\u5668\u5173\u8054\u7684\u3002\u60a8\u53ef\u4ee5\u5c06pyc\u6587\u4ef6\u4e0e\u5176\u4ed6\u4f9d\u8d56\u9879\u4e00\u8d77\u6253\u5305\uff0c\u4f7f\u7528\u5de5\u5177\u5982<code>setuptools<\/code>\u6216<code>wheel<\/code>\u6765\u521b\u5efa\u53ef\u5206\u53d1\u7684Python\u5305\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u7528\u6237\u5728\u5b89\u88c5\u65f6\u83b7\u5f97\u6b63\u786e\u7684\u5b57\u8282\u7801\u6587\u4ef6\uff0c\u540c\u65f6\u4fdd\u6301\u9879\u76ee\u7684\u7ed3\u6784\u6e05\u6670\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u53d1\u5e03 .pyc \u6587\u4ef6\uff0c\u9996\u5148\u9700\u8981\u7406\u89e3\u5b83\u4eec\u662f Python \u7f16\u8bd1\u5668\u751f\u6210\u7684\u5b57\u8282\u7801\u6587\u4ef6\uff0c\u901a\u5e38\u4e0d\u5efa\u8bae\u5355\u72ec\u53d1\u5e03 .pyc [&hellip;]","protected":false},"author":3,"featured_media":952887,"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\/952885"}],"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=952885"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/952885\/revisions"}],"predecessor-version":[{"id":952888,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/952885\/revisions\/952888"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/952887"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=952885"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=952885"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=952885"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}