{"id":1082555,"date":"2025-01-08T12:50:00","date_gmt":"2025-01-08T04:50:00","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1082555.html"},"modified":"2025-01-08T12:50:03","modified_gmt":"2025-01-08T04:50:03","slug":"%e5%a6%82%e4%bd%95%e8%bf%90%e8%a1%8cpython3-7%e6%96%87%e4%bb%b6-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1082555.html","title":{"rendered":"\u5982\u4f55\u8fd0\u884cpython3.7\u6587\u4ef6"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24184026\/1641d800-03c8-4774-b35f-0070fb75fb12.webp\" alt=\"\u5982\u4f55\u8fd0\u884cpython3.7\u6587\u4ef6\" \/><\/p>\n<p><p> <strong>\u8981\u8fd0\u884cPython 3.7\u6587\u4ef6\uff0c\u60a8\u9700\u8981\u5b89\u88c5Python 3.7\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u4f7f\u7528\u7ec8\u7aef\u6216\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u5e76\u786e\u4fdd\u60a8\u7684\u811a\u672c\u6ca1\u6709\u8bed\u6cd5\u9519\u8bef\u3002<\/strong> \u9996\u5148\uff0c\u786e\u4fdd\u5df2\u5b89\u88c5Python 3.7\uff0c\u7136\u540e\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u4ee5\u4fbf\u5728\u7ec8\u7aef\u4e2d\u8c03\u7528Python 3.7\uff0c\u6700\u540e\u5728\u7ec8\u7aef\u4e2d\u5bfc\u822a\u5230\u811a\u672c\u6240\u5728\u76ee\u5f55\u5e76\u8fd0\u884c\u811a\u672c\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5b8c\u6210\u8fd9\u4e9b\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u5b89\u88c5Python 3.7<\/h3>\n<\/p>\n<p><h4>1. \u4e0b\u8f7dPython 3.7<\/h4>\n<\/p>\n<p><p>\u524d\u5f80Python\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/downloads\/release\/python-370\/%EF%BC%89%E4%B8%8B%E8%BD%BD%E9%80%82%E7%94%A8%E4%BA%8E%E6%82%A8%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%9A%84Python\">https:\/\/www.python.org\/downloads\/release\/python-370\/\uff09\u4e0b\u8f7d\u9002\u7528\u4e8e\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684Python<\/a> 3.7\u5b89\u88c5\u5305\u3002<\/p>\n<\/p>\n<p><h4>2. \u5b89\u88c5Python 3.7<\/h4>\n<\/p>\n<p><p>\u6839\u636e\u60a8\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0c\u8fd0\u884c\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\u5e76\u6309\u7167\u63d0\u793a\u5b8c\u6210\u5b89\u88c5\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u786e\u4fdd\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u4ee5\u4fbf\u81ea\u52a8\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u624b\u52a8\u8bbe\u7f6ePython 3.7\u7684\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u4fbf\u5728\u7ec8\u7aef\u4e2d\u8c03\u7528Python 3.7\u3002<\/p>\n<\/p>\n<p><h4>1. Windows<\/h4>\n<\/p>\n<ul>\n<li>\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u201c\u8ba1\u7b97\u673a\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\uff0c\u7136\u540e\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u3002<\/li>\n<li>\u5728\u7cfb\u7edf\u53d8\u91cf\u4e2d\u627e\u5230\u201cPath\u201d\u53d8\u91cf\uff0c\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u3002<\/li>\n<li>\u6dfb\u52a0Python 3.7\u7684\u5b89\u88c5\u8def\u5f84\uff08\u4f8b\u5982\uff1aC:\\Python37\\\uff09\u548cScripts\u76ee\u5f55\u8def\u5f84\uff08\u4f8b\u5982\uff1aC:\\Python37\\Scripts\\\uff09\u3002<\/li>\n<\/ul>\n<p><h4>2. macOS\u548cLinux<\/h4>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u7ec8\u7aef\u3002<\/li>\n<li>\u7f16\u8f91\u60a8\u7684shell\u914d\u7f6e\u6587\u4ef6\uff08.bashrc\u3001.zshrc\u6216.profile\uff09\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a\n<pre><code class=\"language-sh\">export PATH=&quot;\/usr\/local\/bin\/python3.7:$PATH&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u4fdd\u5b58\u6587\u4ef6\u5e76\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\uff1a\n<pre><code class=\"language-sh\">source ~\/.bashrc   # \u6216\u8005 source ~\/.zshrc, source ~\/.profile<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p><h3>\u4e09\u3001\u4f7f\u7528\u7ec8\u7aef\u6216\u547d\u4ee4\u884c\u5de5\u5177<\/h3>\n<\/p>\n<p><h4>1. \u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26<\/h4>\n<\/p>\n<p><p>\u6839\u636e\u60a8\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0c\u6253\u5f00\u7ec8\u7aef\uff08macOS\u548cLinux\uff09\u6216\u547d\u4ee4\u63d0\u793a\u7b26\uff08Windows\uff09\u3002<\/p>\n<\/p>\n<p><h4>2. \u5bfc\u822a\u5230\u811a\u672c\u6240\u5728\u76ee\u5f55<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u5bfc\u822a\u5230\u5305\u542b\u60a8\u8981\u8fd0\u884c\u7684Python\u811a\u672c\u7684\u76ee\u5f55\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">cd path\/to\/your\/script<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u8fd0\u884cPython\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u5728\u5bfc\u822a\u5230\u811a\u672c\u6240\u5728\u76ee\u5f55\u540e\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fd0\u884cPython 3.7\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">python3.7 script_name.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u786e\u4fdd\u5c06<code>script_name.py<\/code>\u66ff\u6362\u4e3a\u60a8\u7684Python\u811a\u672c\u7684\u5b9e\u9645\u6587\u4ef6\u540d\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u786e\u4fdd\u811a\u672c\u6ca1\u6709\u8bed\u6cd5\u9519\u8bef<\/h3>\n<\/p>\n<p><p>\u5728\u8fd0\u884cPython\u811a\u672c\u4e4b\u524d\uff0c\u68c0\u67e5\u811a\u672c\u662f\u5426\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\u6216\u5176\u4ed6\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u68c0\u67e5\u70b9\uff1a<\/p>\n<\/p>\n<p><h4>1. \u8bed\u6cd5\u68c0\u67e5<\/h4>\n<\/p>\n<p><p>\u786e\u4fdd\u60a8\u7684Python\u811a\u672c\u7b26\u5408Python 3.7\u7684\u8bed\u6cd5\u89c4\u5219\u3002<\/p>\n<\/p>\n<p><h4>2. \u4f9d\u8d56\u9879\u68c0\u67e5<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u60a8\u7684\u811a\u672c\u4f9d\u8d56\u4e8e\u7b2c\u4e09\u65b9\u5e93\uff0c\u8bf7\u786e\u4fdd\u8fd9\u4e9b\u5e93\u5df2\u5b89\u88c5\u3002\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u5b89\u88c5\u6240\u9700\u5e93\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u6d4b\u8bd5\u811a\u672c<\/h4>\n<\/p>\n<p><p>\u5728\u8fd0\u884c\u811a\u672c\u4e4b\u524d\uff0c\u5efa\u8bae\u5728\u5f00\u53d1\u73af\u5883\u4e2d\u8fdb\u884c\u6d4b\u8bd5\uff0c\u4ee5\u786e\u4fdd\u811a\u672c\u6309\u9884\u671f\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u793a\u4f8b\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684Python 3.7\u811a\u672c\u793a\u4f8b\uff0c\u6f14\u793a\u5982\u4f55\u8fd0\u884cPython\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># script_name.py<\/p>\n<p>def greet(name):<\/p>\n<p>    print(f&quot;Hello, {name}!&quot;)<\/p>\n<p>if __name__ == &quot;__m<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n__&quot;:<\/p>\n<p>    name = input(&quot;Enter your name: &quot;)<\/p>\n<p>    greet(name)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u8be5\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">python3.7 script_name.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e03\u3001\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6cd5<\/h3>\n<\/p>\n<p><h4>1. \u627e\u4e0d\u5230Python\u89e3\u91ca\u5668<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u5728\u8fd0\u884c\u811a\u672c\u65f6\u9047\u5230\u201c\u627e\u4e0d\u5230Python\u89e3\u91ca\u5668\u201d\u7684\u9519\u8bef\uff0c\u8bf7\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u662f\u5426\u6b63\u786e\u914d\u7f6e\uff0c\u5e76\u786e\u4fddPython 3.7\u5df2\u6210\u529f\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><h4>2. \u4f9d\u8d56\u5e93\u672a\u5b89\u88c5<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u811a\u672c\u4f9d\u8d56\u7684\u7b2c\u4e09\u65b9\u5e93\u672a\u5b89\u88c5\uff0c\u8bf7\u4f7f\u7528<code>pip<\/code>\u5b89\u88c5\u6240\u9700\u5e93\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install numpy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u8bed\u6cd5\u9519\u8bef<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u811a\u672c\u4e2d\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\uff0c\u8bf7\u68c0\u67e5\u4ee3\u7801\u5e76\u4fee\u590d\u9519\u8bef\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee3\u7801\u7f16\u8f91\u5668\u6216IDE\uff08\u5982PyCharm\u3001Visual Studio Code\uff09\u6765\u5e2e\u52a9\u8bc6\u522b\u548c\u4fee\u590d\u8bed\u6cd5\u9519\u8bef\u3002<\/p>\n<\/p>\n<p><h3>\u516b\u3001\u4f7f\u7528IDE\u8fd0\u884cPython\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u9664\u4e86\u4f7f\u7528\u7ec8\u7aef\u6216\u547d\u4ee4\u884c\u5de5\u5177\u5916\uff0c\u60a8\u8fd8\u53ef\u4ee5\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u6765\u8fd0\u884cPython\u811a\u672c\u3002\u4ee5\u4e0b\u662f\u5e38\u89c1\u7684Python IDE\u53ca\u5176\u4f7f\u7528\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><h4>1. PyCharm<\/h4>\n<\/p>\n<ul>\n<li>\u6253\u5f00PyCharm\u5e76\u521b\u5efa\u4e00\u4e2a\u65b0\u9879\u76ee\u6216\u5bfc\u5165\u73b0\u6709\u9879\u76ee\u3002<\/li>\n<li>\u5728\u9879\u76ee<a href=\"https:\/\/docs.pingcode.com\/blog\/project-management\/58557.html\" target=\"_blank\">\u8d44\u6e90\u7ba1\u7406<\/a>\u5668\u4e2d\u627e\u5230\u60a8\u7684Python\u811a\u672c\u6587\u4ef6\u3002<\/li>\n<li>\u53f3\u952e\u70b9\u51fb\u811a\u672c\u6587\u4ef6\uff0c\u9009\u62e9\u201cRun &#39;script_name&#39;\u201d\u3002<\/li>\n<\/ul>\n<p><h4>2. Visual Studio Code<\/h4>\n<\/p>\n<ul>\n<li>\u6253\u5f00Visual Studio Code\u5e76\u5b89\u88c5Python\u6269\u5c55\u3002<\/li>\n<li>\u6253\u5f00\u5305\u542bPython\u811a\u672c\u7684\u6587\u4ef6\u5939\u3002<\/li>\n<li>\u5728\u6587\u4ef6\u8d44\u6e90\u7ba1\u7406\u5668\u4e2d\u627e\u5230\u60a8\u7684Python\u811a\u672c\u6587\u4ef6\u5e76\u6253\u5f00\u3002<\/li>\n<li>\u70b9\u51fb\u53f3\u4e0a\u89d2\u7684\u201c\u8fd0\u884c\u201d\u6309\u94ae\uff0c\u6216\u6309<code>F5<\/code>\u952e\u8fd0\u884c\u811a\u672c\u3002<\/li>\n<\/ul>\n<p><h4>3. Jupyter Notebook<\/h4>\n<\/p>\n<ul>\n<li>\u5b89\u88c5Jupyter Notebook\uff1a\n<pre><code class=\"language-sh\">pip install notebook<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u542f\u52a8Jupyter Notebook\uff1a\n<pre><code class=\"language-sh\">jupyter notebook<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u5728Jupyter Notebook\u754c\u9762\u4e2d\uff0c\u5bfc\u822a\u5230\u5305\u542bPython\u811a\u672c\u7684\u76ee\u5f55\u5e76\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Notebook\u6216\u5bfc\u5165\u73b0\u6709\u811a\u672c\u3002<\/li>\n<\/ul>\n<p><h3>\u4e5d\u3001\u8c03\u8bd5Python\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u5728\u8fd0\u884cPython\u811a\u672c\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u5404\u79cd\u9519\u8bef\u548c\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u8c03\u8bd5\u6280\u5de7\uff1a<\/p>\n<\/p>\n<p><h4>1. \u6253\u5370\u8c03\u8bd5\u4fe1\u606f<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>print<\/code>\u8bed\u53e5\u5728\u811a\u672c\u4e2d\u6253\u5370\u8c03\u8bd5\u4fe1\u606f\uff0c\u4ee5\u4fbf\u4e86\u89e3\u811a\u672c\u7684\u6267\u884c\u8fc7\u7a0b\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def greet(name):<\/p>\n<p>    print(f&quot;Greeting function called with name: {name}&quot;)<\/p>\n<p>    print(f&quot;Hello, {name}!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u4f7f\u7528\u65ad\u70b9<\/h4>\n<\/p>\n<p><p>\u5728IDE\u4e2d\u8bbe\u7f6e\u65ad\u70b9\uff0c\u4ee5\u4fbf\u5728\u7279\u5b9a\u4f4d\u7f6e\u6682\u505c\u811a\u672c\u6267\u884c\u5e76\u68c0\u67e5\u53d8\u91cf\u503c\u548c\u7a0b\u5e8f\u72b6\u6001\u3002<\/p>\n<\/p>\n<p><h4>3. \u4f7f\u7528\u8c03\u8bd5\u5de5\u5177<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528Python\u7684\u5185\u7f6e\u8c03\u8bd5\u5de5\u5177\uff08\u5982<code>pdb<\/code>\uff09\u6216\u7b2c\u4e09\u65b9\u8c03\u8bd5\u5de5\u5177\uff08\u5982<code>ipdb<\/code>\uff09\u8fdb\u884c\u8c03\u8bd5\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pdb; pdb.set_trace()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u5341\u3001\u4f18\u5316Python\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u5728\u786e\u4fddPython\u811a\u672c\u80fd\u591f\u6b63\u786e\u8fd0\u884c\u4e4b\u540e\uff0c\u60a8\u53ef\u4ee5\u8003\u8651\u5bf9\u811a\u672c\u8fdb\u884c\u4f18\u5316\uff0c\u4ee5\u63d0\u9ad8\u5176\u6027\u80fd\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<\/p>\n<p><h4>1. \u4f18\u5316\u7b97\u6cd5<\/h4>\n<\/p>\n<p><p>\u9009\u62e9\u66f4\u9ad8\u6548\u7684\u7b97\u6cd5\u548c\u6570\u636e\u7ed3\u6784\uff0c\u4ee5\u63d0\u9ad8\u811a\u672c\u7684\u6027\u80fd\u3002<\/p>\n<\/p>\n<p><h4>2. \u4f18\u5316\u4ee3\u7801\u7ed3\u6784<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528\u51fd\u6570\u548c\u7c7b\u6765\u7ec4\u7ec7\u4ee3\u7801\uff0c\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<\/p>\n<p><h4>3. \u4f7f\u7528\u5e76\u884c\u5904\u7406<\/h4>\n<\/p>\n<p><p>\u5bf9\u4e8e\u9700\u8981\u5927\u91cf\u8ba1\u7b97\u7684\u4efb\u52a1\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u7ebf\u7a0b\u6216\u591a\u8fdb\u7a0b\u6765\u63d0\u9ad8\u6267\u884c\u6548\u7387\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>concurrent.futures<\/code>\u6a21\u5757\u6765\u5b9e\u73b0\u5e76\u884c\u5904\u7406\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u4e00\u3001\u90e8\u7f72Python\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u5728\u5f00\u53d1\u548c\u4f18\u5316Python\u811a\u672c\u4e4b\u540e\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u5c06\u811a\u672c\u90e8\u7f72\u5230\u751f\u4ea7\u73af\u5883\u4e2d\u3002\u4ee5\u4e0b\u662f\u5e38\u89c1\u7684\u90e8\u7f72\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><h4>1. \u90e8\u7f72\u5230\u670d\u52a1\u5668<\/h4>\n<\/p>\n<p><p>\u5c06Python\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u5e76\u4f7f\u7528<code>cron<\/code>\u4f5c\u4e1a\u6216\u7cfb\u7edf\u670d\u52a1\u6765\u81ea\u52a8\u8fd0\u884c\u811a\u672c\u3002<\/p>\n<\/p>\n<p><h4>2. \u90e8\u7f72\u5230\u4e91\u5e73\u53f0<\/h4>\n<\/p>\n<p><p>\u5c06Python\u811a\u672c\u90e8\u7f72\u5230\u4e91\u5e73\u53f0\uff08\u5982AWS Lambda\u3001Google Cloud Functions\u3001Azure Functions\uff09\u4e0a\uff0c\u4ee5\u4fbf\u81ea\u52a8\u8fd0\u884c\u811a\u672c\u3002<\/p>\n<\/p>\n<p><h4>3. \u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528\u5de5\u5177\uff08\u5982<code>PyInstaller<\/code>\u3001<code>cx_Freeze<\/code>\uff09\u5c06Python\u811a\u672c\u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u4ee5\u4fbf\u5728\u76ee\u6807\u5e73\u53f0\u4e0a\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u4e8c\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u8fd0\u884cPython 3.7\u6587\u4ef6\u9700\u8981\u5b89\u88c5Python 3.7\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u4f7f\u7528\u7ec8\u7aef\u6216\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u5e76\u786e\u4fdd\u811a\u672c\u6ca1\u6709\u8bed\u6cd5\u9519\u8bef\u3002\u5728\u8fd0\u884c\u811a\u672c\u4e4b\u524d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee3\u7801\u7f16\u8f91\u5668\u6216IDE\u8fdb\u884c\u5f00\u53d1\u548c\u8c03\u8bd5\u3002\u90e8\u7f72\u811a\u672c\u65f6\uff0c\u53ef\u4ee5\u9009\u62e9\u5c06\u5176\u90e8\u7f72\u5230\u670d\u52a1\u5668\u3001\u4e91\u5e73\u53f0\u6216\u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u3002\u901a\u8fc7\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u9ad8\u6548\u5730\u8fd0\u884c\u548c\u7ba1\u7406Python 3.7\u811a\u672c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Windows\u7cfb\u7edf\u4e0a\u8fd0\u884cPython 3.7\u6587\u4ef6\uff1f<\/strong><br \/>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u63d0\u793a\u7b26\u8fd0\u884cPython 3.7\u6587\u4ef6\u3002\u9996\u5148\uff0c\u786e\u4fdd\u5df2\u5b89\u88c5Python 3.7\u5e76\u5c06\u5176\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u5bfc\u822a\u5230\u5305\u542b\u60a8\u7684Python\u6587\u4ef6\u7684\u76ee\u5f55\uff0c\u8f93\u5165\u547d\u4ee4<code>python yourfile.py<\/code>\u6765\u8fd0\u884c\u6587\u4ef6\u3002\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fIDLE\u6216\u5176\u4ed6IDE\uff0c\u53ea\u9700\u5728\u7a0b\u5e8f\u4e2d\u6253\u5f00\u6587\u4ef6\u5e76\u70b9\u51fb\u201c\u8fd0\u884c\u201d\u5373\u53ef\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Linux\u6216macOS\u4e0a\u8fd0\u884cPython 3.7\u6587\u4ef6\uff1f<\/strong><br \/>\u5728Linux\u6216macOS\u7cfb\u7edf\u4e2d\uff0c\u6253\u5f00\u7ec8\u7aef\u5e76\u786e\u4fddPython 3.7\u5df2\u5b89\u88c5\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4<code>python3 yourfile.py<\/code>\u6765\u8fd0\u884c\u6587\u4ef6\uff0c\u786e\u4fdd\u5728\u6587\u4ef6\u540d\u4e4b\u524d\u4f7f\u7528<code>python3<\/code>\u6765\u6307\u5b9a\u7248\u672c\u3002\u5982\u679c\u60a8\u5e0c\u671b\u6587\u4ef6\u53ef\u6267\u884c\uff0c\u53ef\u4ee5\u5728\u6587\u4ef6\u9876\u90e8\u6dfb\u52a0<code>#!\/usr\/bin\/env python3<\/code>\uff0c\u7136\u540e\u4f7f\u7528<code>chmod +x yourfile.py<\/code>\u547d\u4ee4\u8d4b\u4e88\u6267\u884c\u6743\u9650\uff0c\u63a5\u7740\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7<code>.\/yourfile.py<\/code>\u8fd0\u884c\u3002<\/p>\n<p><strong>\u5982\u4f55\u8c03\u8bd5\u8fd0\u884c\u4e2d\u7684Python 3.7\u6587\u4ef6\uff1f<\/strong><br \/>\u5728\u8fd0\u884cPython 3.7\u6587\u4ef6\u65f6\uff0c\u5982\u679c\u9047\u5230\u9519\u8bef\u6216\u9700\u8981\u8c03\u8bd5\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u5185\u7f6e\u7684<code>pdb<\/code>\u6a21\u5757\u3002\u5728\u4ee3\u7801\u4e2d\u63d2\u5165<code>import pdb; pdb.set_trace()<\/code>\uff0c\u7a0b\u5e8f\u4f1a\u5728\u8be5\u884c\u505c\u6b62\u5e76\u5141\u8bb8\u60a8\u9010\u6b65\u6267\u884c\u4ee3\u7801\u3002\u60a8\u8fd8\u53ef\u4ee5\u4f7f\u7528IDE\uff08\u5982PyCharm\u6216VSCode\uff09\u4e2d\u7684\u8c03\u8bd5\u5de5\u5177\uff0c\u8bbe\u7f6e\u65ad\u70b9\u5e76\u9010\u884c\u68c0\u67e5\u4ee3\u7801\uff0c\u5e2e\u52a9\u8bc6\u522b\u548c\u89e3\u51b3\u95ee\u9898\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u8fd0\u884cPython 3.7\u6587\u4ef6\uff0c\u60a8\u9700\u8981\u5b89\u88c5Python 3.7\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u4f7f\u7528\u7ec8\u7aef\u6216\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u5e76\u786e\u4fdd\u60a8\u7684 [&hellip;]","protected":false},"author":3,"featured_media":1082564,"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\/1082555"}],"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=1082555"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1082555\/revisions"}],"predecessor-version":[{"id":1082566,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1082555\/revisions\/1082566"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1082564"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1082555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1082555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1082555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}