{"id":1155255,"date":"2025-01-13T18:01:13","date_gmt":"2025-01-13T10:01:13","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1155255.html"},"modified":"2025-01-13T18:01:16","modified_gmt":"2025-01-13T10:01:16","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8cmd-%e6%89%a7%e8%a1%8cpython","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1155255.html","title":{"rendered":"\u5982\u4f55\u5728cmd \u6267\u884cpython"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25184635\/744d4ec6-94f8-4bd4-ba56-e10e23d6f603.webp\" alt=\"\u5982\u4f55\u5728cmd \u6267\u884cpython\" \/><\/p>\n<p><p> <strong>\u5728cmd\u6267\u884cPython\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u5b89\u88c5Python\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u9a8c\u8bc1\u5b89\u88c5\u3001\u7f16\u5199Python\u811a\u672c\u3001\u8fd0\u884cPython\u811a\u672c\u3002<\/strong><\/p>\n<\/p>\n<p><h3>\u5b89\u88c5Python<\/h3>\n<\/p>\n<p><p>\u8981\u5728cmd\u4e2d\u6267\u884cPython\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u3002\u5982\u679c\u8fd8\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%E4%B8%8B%E8%BD%BD%E9%80%82%E5%90%88%E4%BD%A0%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%9A%84Python%E5%AE%89%E8%A3%85%E5%8C%85%E3%80%82%E5%AE%89%E8%A3%85%E8%BF%87%E7%A8%8B%E4%B8%AD%EF%BC%8C%E5%BB%BA%E8%AE%AE%E5%8B%BE%E9%80%89%E2%80%9CAdd\">https:\/\/www.python.org\/\uff09\u4e0b\u8f7d\u9002\u5408\u4f60\u64cd\u4f5c\u7cfb\u7edf\u7684Python\u5b89\u88c5\u5305\u3002\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u5efa\u8bae\u52fe\u9009\u201cAdd<\/a> Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u6837\u4f1a\u81ea\u52a8\u5c06Python\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/p>\n<\/p>\n<p><h3>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u5b89\u88c5Python\u65f6\u6ca1\u6709\u52fe\u9009\u201cAdd Python to PATH\u201d\uff0c\u9700\u8981\u624b\u52a8\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u56fe\u6807\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u9009\u62e9\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u4e2d\uff0c\u627e\u5230\u5e76\u9009\u4e2d\u201cPath\u201d\uff0c\u7136\u540e\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u6309\u94ae\u3002<\/li>\n<li>\u5728\u201c\u7f16\u8f91\u73af\u5883\u53d8\u91cf\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u65b0\u5efa\u201d\uff0c\u7136\u540e\u8f93\u5165Python\u7684\u5b89\u88c5\u8def\u5f84\uff08\u4f8b\u5982\uff1aC:\\Python39\\\uff0c\u5177\u4f53\u8def\u5f84\u6839\u636e\u5b9e\u9645\u5b89\u88c5\u4f4d\u7f6e\u586b\u5199\uff09\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u6309\u94ae\u4fdd\u5b58\u8bbe\u7f6e\u3002<\/li>\n<\/ol>\n<p><h3>\u9a8c\u8bc1\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u540e\uff0c\u53ef\u4ee5\u6253\u5f00cmd\u7a97\u53e3\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u9a8c\u8bc1Python\u662f\u5426\u5b89\u88c5\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u5b89\u88c5\u6210\u529f\uff0c\u4f1a\u663e\u793aPython\u7684\u7248\u672c\u53f7\uff0c\u4f8b\u5982\uff1aPython 3.9.0\u3002<\/p>\n<\/p>\n<p><h3>\u7f16\u5199Python\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u5728cmd\u4e2d\u6267\u884cPython\u811a\u672c\u4e4b\u524d\uff0c\u9700\u8981\u5148\u7f16\u5199\u4e00\u4e2aPython\u811a\u672c\u3002\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u6587\u672c\u7f16\u8f91\u5668\uff08\u4f8b\u5982\uff1aNotepad++\u3001Sublime Text\u3001VS Code\u7b49\uff09\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684Python\u811a\u672c\u3002\u4f8b\u5982\uff0c\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>hello.py<\/code>\u7684\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\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><h3>\u8fd0\u884cPython\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u5728cmd\u4e2d\u8fd0\u884cPython\u811a\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">python hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0ccmd\u7a97\u53e3\u4e2d\u4f1a\u8f93\u51fa\u201cHello, World!\u201d\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u5b89\u88c5Python<\/h2>\n<\/p>\n<p><h3>\u5b89\u88c5\u6b65\u9aa4<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5Python\u7684\u6b65\u9aa4\u5e76\u4e0d\u590d\u6742\uff0c\u4e3b\u8981\u5206\u4e3a\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u4e0b\u8f7d\u5b89\u88c5\u5305<\/strong>\uff1a\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%EF%BC%8C%E6%A0%B9%E6%8D%AE%E8%87%AA%E5%B7%B1%E7%9A%84%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E9%80%89%E6%8B%A9%E5%90%88%E9%80%82%E7%9A%84Python%E7%89%88%E6%9C%AC%E8%BF%9B%E8%A1%8C%E4%B8%8B%E8%BD%BD%E3%80%82%E4%B8%80%E8%88%AC%E5%BB%BA%E8%AE%AE%E9%80%89%E6%8B%A9%E6%9C%80%E6%96%B0%E7%9A%84%E7%A8%B3%E5%AE%9A%E7%89%88%E6%9C%AC%E3%80%82\">https:\/\/www.python.org\/\uff09\uff0c\u6839\u636e\u81ea\u5df1\u7684\u64cd\u4f5c\u7cfb\u7edf\u9009\u62e9\u5408\u9002\u7684Python\u7248\u672c\u8fdb\u884c\u4e0b\u8f7d\u3002\u4e00\u822c\u5efa\u8bae\u9009\u62e9\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u3002<\/a><\/li>\n<li><strong>\u8fd0\u884c\u5b89\u88c5\u5305<\/strong>\uff1a\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u5b89\u88c5\u5305\u3002\u5b89\u88c5\u8fc7\u7a0b\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u6309\u7167\u63d0\u793a\u4e00\u6b65\u6b65\u64cd\u4f5c\u5373\u53ef\u3002<\/li>\n<li><strong>\u9009\u62e9\u5b89\u88c5\u9009\u9879<\/strong>\uff1a\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u6709\u4e00\u4e2a\u9009\u9879\u662f\u201cAdd Python to PATH\u201d\uff0c\u5f3a\u70c8\u5efa\u8bae\u52fe\u9009\u8fd9\u4e2a\u9009\u9879\uff0c\u8fd9\u6837\u4f1a\u81ea\u52a8\u5c06Python\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u65b9\u4fbf\u540e\u7eed\u5728cmd\u4e2d\u4f7f\u7528Python\u3002<\/li>\n<\/ol>\n<p><h3>\u5b89\u88c5\u5b8c\u6210\u540e\u7684\u9a8c\u8bc1<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u6253\u5f00cmd\u7a97\u53e3\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u9a8c\u8bc1Python\u662f\u5426\u5b89\u88c5\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u5b89\u88c5\u6210\u529f\uff0c\u4f1a\u663e\u793aPython\u7684\u7248\u672c\u53f7\uff0c\u4f8b\u5982\uff1aPython 3.9.0\u3002<\/p>\n<\/p>\n<p><h3>\u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/h3>\n<\/p>\n<p><p>\u5728\u5b89\u88c5Python\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6709\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u5b89\u88c5\u5931\u8d25<\/strong>\uff1a\u5982\u679c\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u9519\u8bef\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u91cd\u65b0\u4e0b\u8f7d\u5b89\u88c5\u5305\uff0c\u6216\u8005\u68c0\u67e5\u7cfb\u7edf\u662f\u5426\u6ee1\u8db3Python\u7684\u5b89\u88c5\u8981\u6c42\u3002<\/li>\n<li><strong>\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u5931\u8d25<\/strong>\uff1a\u5982\u679c\u5b89\u88c5\u65f6\u6ca1\u6709\u52fe\u9009\u201cAdd Python to PATH\u201d\uff0c\u9700\u8981\u624b\u52a8\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u5177\u4f53\u6b65\u9aa4\u53ef\u4ee5\u53c2\u8003\u4e0a\u9762\u7684\u5185\u5bb9\u3002<\/li>\n<\/ol>\n<p><h2>\u4e8c\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/h2>\n<\/p>\n<p><h3>\u4e3a\u4ec0\u4e48\u9700\u8981\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u662f\u4e3a\u4e86\u8ba9\u7cfb\u7edf\u80fd\u591f\u8bc6\u522bPython\u7684\u5b89\u88c5\u8def\u5f84\uff0c\u8fd9\u6837\u53ef\u4ee5\u5728\u4efb\u610f\u4f4d\u7f6e\u76f4\u63a5\u8fd0\u884cPython\u547d\u4ee4\u3002\u5982\u679c\u5728\u5b89\u88c5Python\u65f6\u6ca1\u6709\u52fe\u9009\u201cAdd Python to PATH\u201d\uff0c\u9700\u8981\u624b\u52a8\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<\/p>\n<p><h3>\u624b\u52a8\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u6b65\u9aa4<\/h3>\n<\/p>\n<ol>\n<li><strong>\u6253\u5f00\u7cfb\u7edf\u5c5e\u6027<\/strong>\uff1a\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u56fe\u6807\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li><strong>\u6253\u5f00\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e<\/strong>\uff1a\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u3002<\/li>\n<li><strong>\u6253\u5f00\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u7a97\u53e3<\/strong>\uff1a\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\u3002<\/li>\n<li><strong>\u7f16\u8f91\u7cfb\u7edf\u53d8\u91cf<\/strong>\uff1a\u5728\u201c\u73af\u5883\u53d8\u91cf\u201d\u7a97\u53e3\u4e2d\uff0c\u627e\u5230\u5e76\u9009\u4e2d\u201cPath\u201d\uff0c\u7136\u540e\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u6309\u94ae\u3002<\/li>\n<li><strong>\u6dfb\u52a0Python\u8def\u5f84<\/strong>\uff1a\u5728\u201c\u7f16\u8f91\u73af\u5883\u53d8\u91cf\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u65b0\u5efa\u201d\uff0c\u7136\u540e\u8f93\u5165Python\u7684\u5b89\u88c5\u8def\u5f84\uff08\u4f8b\u5982\uff1aC:\\Python39\\\uff0c\u5177\u4f53\u8def\u5f84\u6839\u636e\u5b9e\u9645\u5b89\u88c5\u4f4d\u7f6e\u586b\u5199\uff09\u3002<\/li>\n<li><strong>\u4fdd\u5b58\u8bbe\u7f6e<\/strong>\uff1a\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u6309\u94ae\u4fdd\u5b58\u8bbe\u7f6e\u3002<\/li>\n<\/ol>\n<p><h3>\u9a8c\u8bc1\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e<\/h3>\n<\/p>\n<p><p>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u540e\uff0c\u53ef\u4ee5\u6253\u5f00cmd\u7a97\u53e3\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u9a8c\u8bc1Python\u662f\u5426\u5b89\u88c5\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u6210\u529f\uff0c\u4f1a\u663e\u793aPython\u7684\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<p><h3>\u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/h3>\n<\/p>\n<p><p>\u5728\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6709\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u8def\u5f84\u8bbe\u7f6e\u9519\u8bef<\/strong>\uff1a\u5982\u679c\u8f93\u5165\u7684Python\u8def\u5f84\u6709\u8bef\uff0c\u7cfb\u7edf\u5c06\u65e0\u6cd5\u8bc6\u522bPython\u547d\u4ee4\u3002\u53ef\u4ee5\u91cd\u65b0\u68c0\u67e5\u5e76\u786e\u8ba4Python\u7684\u5b89\u88c5\u8def\u5f84\u3002<\/li>\n<li><strong>\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u672a\u751f\u6548<\/strong>\uff1a\u6709\u65f6\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u540e\u9700\u8981\u91cd\u65b0\u542f\u52a8cmd\u7a97\u53e3\uff0c\u624d\u80fd\u4f7f\u8bbe\u7f6e\u751f\u6548\u3002<\/li>\n<\/ol>\n<p><h2>\u4e09\u3001\u7f16\u5199Python\u811a\u672c<\/h2>\n<\/p>\n<p><h3>\u9009\u62e9\u5408\u9002\u7684\u6587\u672c\u7f16\u8f91\u5668<\/h3>\n<\/p>\n<p><p>\u7f16\u5199Python\u811a\u672c\u9700\u8981\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u3002\u5e02\u9762\u4e0a\u6709\u8bb8\u591a\u4f18\u79c0\u7684\u6587\u672c\u7f16\u8f91\u5668\u53ef\u4f9b\u9009\u62e9\uff0c\u5e38\u89c1\u7684\u6709\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>Notepad++<\/strong>\uff1a\u4e00\u6b3e\u8f7b\u91cf\u7ea7\u7684\u6587\u672c\u7f16\u8f91\u5668\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\u7684\u8bed\u6cd5\u9ad8\u4eae\u3002<\/li>\n<li><strong>Sublime Text<\/strong>\uff1a\u4e00\u6b3e\u529f\u80fd\u5f3a\u5927\u7684\u6587\u672c\u7f16\u8f91\u5668\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\u7684\u63d2\u4ef6\u548c\u6269\u5c55\u3002<\/li>\n<li><strong>VS Code<\/strong>\uff1a\u4e00\u6b3e\u7531\u5fae\u8f6f\u5f00\u53d1\u7684\u5f00\u6e90\u6587\u672c\u7f16\u8f91\u5668\uff0c\u529f\u80fd\u975e\u5e38\u5f3a\u5927\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\u7684\u5f00\u53d1\u548c\u8c03\u8bd5\u3002<\/li>\n<\/ol>\n<p><h3>\u7f16\u5199\u7b80\u5355\u7684Python\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u6587\u672c\u7f16\u8f91\u5668\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684Python\u811a\u672c\u3002\u4f8b\u5982\uff0c\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>hello.py<\/code>\u7684\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\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><h3>\u4fdd\u5b58\u811a\u672c\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u7f16\u5199\u5b8c\u6210\u540e\uff0c\u5c06\u811a\u672c\u6587\u4ef6\u4fdd\u5b58\u4e3a<code>.py<\/code>\u683c\u5f0f\u3002\u4f8b\u5982\uff0c\u5c06\u4e0a\u9762\u7684\u811a\u672c\u4fdd\u5b58\u4e3a<code>hello.py<\/code>\u3002<\/p>\n<\/p>\n<p><h3>\u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/h3>\n<\/p>\n<p><p>\u5728\u7f16\u5199Python\u811a\u672c\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6709\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u8bed\u6cd5\u9519\u8bef<\/strong>\uff1a\u7f16\u5199Python\u811a\u672c\u65f6\u9700\u8981\u6ce8\u610f\u8bed\u6cd5\uff0c\u5982\u679c\u6709\u8bed\u6cd5\u9519\u8bef\uff0c\u811a\u672c\u5c06\u65e0\u6cd5\u8fd0\u884c\u3002\u53ef\u4ee5\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u7684\u8bed\u6cd5\u9ad8\u4eae\u529f\u80fd\u6765\u68c0\u67e5\u8bed\u6cd5\u9519\u8bef\u3002<\/li>\n<li><strong>\u6587\u4ef6\u4fdd\u5b58\u683c\u5f0f\u9519\u8bef<\/strong>\uff1a\u786e\u4fdd\u5c06\u811a\u672c\u6587\u4ef6\u4fdd\u5b58\u4e3a<code>.py<\/code>\u683c\u5f0f\uff0c\u5426\u5219Python\u89e3\u91ca\u5668\u5c06\u65e0\u6cd5\u8bc6\u522b\u3002<\/li>\n<\/ol>\n<p><h2>\u56db\u3001\u8fd0\u884cPython\u811a\u672c<\/h2>\n<\/p>\n<p><h3>\u5728cmd\u4e2d\u8fd0\u884cPython\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u5728cmd\u4e2d\u8fd0\u884cPython\u811a\u672c\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u6253\u5f00cmd\u7a97\u53e3\uff0c\u5bfc\u822a\u5230\u811a\u672c\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\uff0c\u7136\u540e\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">python hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0ccmd\u7a97\u53e3\u4e2d\u4f1a\u8f93\u51fa\u201cHello, World!\u201d\u3002<\/p>\n<\/p>\n<p><h3>\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\u8fd0\u884cPython\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u4e0d\u60f3\u5bfc\u822a\u5230\u811a\u672c\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\uff0c\u53ef\u4ee5\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\u8fd0\u884cPython\u811a\u672c\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">python C:\\path\\to\\your\\script\\hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/h3>\n<\/p>\n<p><p>\u5728\u8fd0\u884cPython\u811a\u672c\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6709\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u627e\u4e0d\u5230\u811a\u672c\u6587\u4ef6<\/strong>\uff1a\u786e\u4fdd\u811a\u672c\u6587\u4ef6\u5b58\u5728\u4e14\u8def\u5f84\u6b63\u786e\u3002\u53ef\u4ee5\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\u8fd0\u884c\u811a\u672c\uff0c\u4ee5\u907f\u514d\u8def\u5f84\u95ee\u9898\u3002<\/li>\n<li><strong>Python\u89e3\u91ca\u5668\u8def\u5f84\u9519\u8bef<\/strong>\uff1a\u5982\u679c\u7cfb\u7edf\u4e2d\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\u7684Python\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u8def\u5f84\u6df7\u4e71\u3002\u53ef\u4ee5\u5728\u547d\u4ee4\u4e2d\u6307\u5b9a\u5177\u4f53\u7684Python\u89e3\u91ca\u5668\u8def\u5f84\uff0c\u4f8b\u5982\uff1a<code>C:\\Python39\\python.exe hello.py<\/code>\u3002<\/li>\n<\/ol>\n<p><h2>\u4e94\u3001\u8c03\u8bd5Python\u811a\u672c<\/h2>\n<\/p>\n<p><h3>\u4f7f\u7528print\u8c03\u8bd5<\/h3>\n<\/p>\n<p><p>\u6700\u7b80\u5355\u7684\u8c03\u8bd5\u65b9\u6cd5\u662f\u4f7f\u7528<code>print<\/code>\u8bed\u53e5\u8f93\u51fa\u53d8\u91cf\u503c\u6216\u7a0b\u5e8f\u6267\u884c\u8fc7\u7a0b\u4e2d\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">a = 10<\/p>\n<p>b = 20<\/p>\n<p>print(&quot;a =&quot;, a)<\/p>\n<p>print(&quot;b =&quot;, b)<\/p>\n<p>c = a + b<\/p>\n<p>print(&quot;c =&quot;, c)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4f7f\u7528\u65ad\u70b9\u8c03\u8bd5<\/h3>\n<\/p>\n<p><p>\u66f4\u9ad8\u7ea7\u7684\u8c03\u8bd5\u65b9\u6cd5\u662f\u4f7f\u7528IDE\uff08\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff09\u63d0\u4f9b\u7684\u65ad\u70b9\u8c03\u8bd5\u529f\u80fd\u3002\u4f8b\u5982\uff0c\u4f7f\u7528VS Code\u53ef\u4ee5\u8bbe\u7f6e\u65ad\u70b9\u5e76\u9010\u6b65\u6267\u884c\u4ee3\u7801\uff0c\u67e5\u770b\u53d8\u91cf\u503c\u548c\u7a0b\u5e8f\u6267\u884c\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<p><h3>\u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/h3>\n<\/p>\n<p><p>\u5728\u8c03\u8bd5Python\u811a\u672c\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6709\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u65e0\u6cd5\u8f93\u51fa\u8c03\u8bd5\u4fe1\u606f<\/strong>\uff1a\u786e\u4fdd<code>print<\/code>\u8bed\u53e5\u4f4d\u7f6e\u6b63\u786e\uff0c\u4e14\u8f93\u51fa\u8bbe\u5907\uff08\u4f8b\u5982cmd\u7a97\u53e3\uff09\u6ca1\u6709\u95ee\u9898\u3002<\/li>\n<li><strong>\u65ad\u70b9\u8c03\u8bd5\u5931\u8d25<\/strong>\uff1a\u786e\u4fdd\u4f7f\u7528\u7684IDE\u652f\u6301\u65ad\u70b9\u8c03\u8bd5\u529f\u80fd\uff0c\u5e76\u6b63\u786e\u914d\u7f6e\u4e86Python\u89e3\u91ca\u5668\u8def\u5f84\u3002<\/li>\n<\/ol>\n<p><h2>\u516d\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883<\/h2>\n<\/p>\n<p><h3>\u4ec0\u4e48\u662f\u865a\u62df\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u865a\u62df\u73af\u5883\u662f\u4e00\u4e2a\u72ec\u7acb\u7684Python\u8fd0\u884c\u73af\u5883\uff0c\u53ef\u4ee5\u5728\u5176\u4e2d\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684Python\u5305\uff0c\u800c\u4e0d\u4f1a\u5f71\u54cd\u7cfb\u7edf\u7684\u5168\u5c40Python\u73af\u5883\u3002\u4f7f\u7528\u865a\u62df\u73af\u5883\u53ef\u4ee5\u907f\u514d\u5305\u7248\u672c\u51b2\u7a81\uff0c\u65b9\u4fbf\u7ba1\u7406\u9879\u76ee\u4f9d\u8d56\u3002<\/p>\n<\/p>\n<p><h3>\u521b\u5efa\u865a\u62df\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>venv<\/code>\u6a21\u5757\u521b\u5efa\u865a\u62df\u73af\u5883\u3002\u4f8b\u5982\uff0c\u6253\u5f00cmd\u7a97\u53e3\uff0c\u5bfc\u822a\u5230\u9879\u76ee\u76ee\u5f55\uff0c\u7136\u540e\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">python -m venv myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>myenv<\/code>\u7684\u865a\u62df\u73af\u5883\u3002<\/p>\n<\/p>\n<p><h3>\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u521b\u5efa\u865a\u62df\u73af\u5883\u540e\uff0c\u9700\u8981\u6fc0\u6d3b\u5b83\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>Windows<\/strong>\uff1a\u5728cmd\u7a97\u53e3\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-cmd\">myenv\\Scripts\\activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li><strong>Linux\/Mac<\/strong>\uff1a\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">source myenv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u547d\u4ee4\u63d0\u793a\u7b26\u4f1a\u663e\u793a\u865a\u62df\u73af\u5883\u7684\u540d\u79f0\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">(myenv) C:\\path\\to\\your\\project&gt;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u5b89\u88c5\u5305\u5230\u865a\u62df\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5\u5305\u5230\u865a\u62df\u73af\u5883\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">pip install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u9000\u51fa\u865a\u62df\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u5b8c\u865a\u62df\u73af\u5883\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9000\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">deactivate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/h3>\n<\/p>\n<p><p>\u5728\u4f7f\u7528\u865a\u62df\u73af\u5883\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6709\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u521b\u5efa\u865a\u62df\u73af\u5883\u5931\u8d25<\/strong>\uff1a\u786e\u4fddPython\u7248\u672c\u652f\u6301<code>venv<\/code>\u6a21\u5757\uff08Python 3.3\u53ca\u4ee5\u4e0a\u7248\u672c\uff09\uff0c\u5e76\u4e14\u5b89\u88c5\u4e86\u5fc5\u8981\u7684\u7cfb\u7edf\u5305\u3002<\/li>\n<li><strong>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u5931\u8d25<\/strong>\uff1a\u786e\u4fdd\u8f93\u5165\u7684\u547d\u4ee4\u6b63\u786e\uff0c\u4e14\u865a\u62df\u73af\u5883\u8def\u5f84\u65e0\u8bef\u3002<\/li>\n<\/ol>\n<p><h2>\u4e03\u3001\u4f7f\u7528pip\u7ba1\u7406\u5305<\/h2>\n<\/p>\n<p><h3>\u4ec0\u4e48\u662fpip<\/h3>\n<\/p>\n<p><p><code>pip<\/code>\u662fPython\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u6765\u5b89\u88c5\u3001\u5347\u7ea7\u3001\u5378\u8f7dPython\u5305\u3002\u4f7f\u7528<code>pip<\/code>\u53ef\u4ee5\u65b9\u4fbf\u5730\u7ba1\u7406\u9879\u76ee\u4f9d\u8d56\u3002<\/p>\n<\/p>\n<p><h3>\u5b89\u88c5\u5305<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>pip install<\/code>\u547d\u4ee4\u5b89\u88c5\u5305\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">pip install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5b89\u88c5<code>requests<\/code>\u5305\u53ca\u5176\u4f9d\u8d56\u3002<\/p>\n<\/p>\n<p><h3>\u5347\u7ea7\u5305<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>pip install --upgrade<\/code>\u547d\u4ee4\u5347\u7ea7\u5305\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">pip install --upgrade requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5347\u7ea7<code>requests<\/code>\u5305\u5230\u6700\u65b0\u7248\u672c\u3002<\/p>\n<\/p>\n<p><h3>\u5378\u8f7d\u5305<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>pip uninstall<\/code>\u547d\u4ee4\u5378\u8f7d\u5305\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">pip uninstall requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5378\u8f7d<code>requests<\/code>\u5305\u53ca\u5176\u4f9d\u8d56\u3002<\/p>\n<\/p>\n<p><h3>\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u5305<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>pip list<\/code>\u547d\u4ee4\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u5305\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">pip list<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u663e\u793a\u7cfb\u7edf\u4e2d\u5df2\u5b89\u88c5\u7684\u6240\u6709Python\u5305\u53ca\u5176\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<p><h3>\u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/h3>\n<\/p>\n<p><p>\u5728\u4f7f\u7528<code>pip<\/code>\u7ba1\u7406\u5305\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6709\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u5b89\u88c5\u5305\u5931\u8d25<\/strong>\uff1a\u786e\u4fdd\u7f51\u7edc\u8fde\u63a5\u6b63\u5e38\uff0c\u4e14<code>pip<\/code>\u914d\u7f6e\u6b63\u786e\u3002\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528\u56fd\u5185\u955c\u50cf\u6e90\uff0c\u4f8b\u5982\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-cmd\">pip install -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li><strong>\u5305\u7248\u672c\u51b2\u7a81<\/strong>\uff1a\u53ef\u4ee5\u4f7f\u7528\u865a\u62df\u73af\u5883\u9694\u79bb\u4e0d\u540c\u9879\u76ee\u7684\u4f9d\u8d56\uff0c\u907f\u514d\u5305\u7248\u672c\u51b2\u7a81\u3002<\/li>\n<\/ol>\n<p><h2>\u516b\u3001\u4f7f\u7528IDE\u5f00\u53d1Python<\/h2>\n<\/p>\n<p><h3>\u4e3a\u4ec0\u4e48\u4f7f\u7528IDE<\/h3>\n<\/p>\n<p><p>\u867d\u7136\u53ef\u4ee5\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u7f16\u5199Python\u811a\u672c\uff0c\u4f46IDE\uff08\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff09\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u8bed\u6cd5\u9ad8\u4eae<\/strong>\uff1a\u53ef\u4ee5\u66f4\u6e05\u6670\u5730\u67e5\u770b\u4ee3\u7801\u7ed3\u6784\u3002<\/li>\n<li><strong>\u81ea\u52a8\u8865\u5168<\/strong>\uff1a\u53ef\u4ee5\u51cf\u5c11\u8f93\u5165\u9519\u8bef\uff0c\u63d0\u9ad8\u7f16\u7801\u901f\u5ea6\u3002<\/li>\n<li><strong>\u8c03\u8bd5\u5de5\u5177<\/strong>\uff1a\u53ef\u4ee5\u65b9\u4fbf\u5730\u8bbe\u7f6e\u65ad\u70b9\uff0c\u9010\u6b65\u6267\u884c\u4ee3\u7801\uff0c\u67e5\u770b\u53d8\u91cf\u503c\u3002<\/li>\n<li><strong><a href=\"https:\/\/docs.pingcode.com\/blog\/project-management\/23316.html\" target=\"_blank\">\u9879\u76ee\u7ba1\u7406<\/a><\/strong>\uff1a\u53ef\u4ee5\u65b9\u4fbf\u5730\u7ba1\u7406\u9879\u76ee\u6587\u4ef6\u548c\u4f9d\u8d56\u3002<\/li>\n<\/ol>\n<p><h3>\u5e38\u89c1\u7684Python IDE<\/h3>\n<\/p>\n<p><p>\u5e02\u9762\u4e0a\u6709\u8bb8\u591a\u4f18\u79c0\u7684Python IDE\u53ef\u4f9b\u9009\u62e9\uff0c\u5e38\u89c1\u7684\u6709\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>PyCharm<\/strong>\uff1a\u4e00\u6b3e\u529f\u80fd\u975e\u5e38\u5f3a\u5927\u7684Python IDE\uff0c\u652f\u6301\u591a\u79cd\u6846\u67b6\u548c\u5e93\u7684\u5f00\u53d1\uff0c\u63d0\u4f9b\u4e30\u5bcc\u7684\u8c03\u8bd5\u5de5\u5177\u548c\u63d2\u4ef6\u3002<\/li>\n<li><strong>VS Code<\/strong>\uff1a\u4e00\u6b3e\u7531\u5fae\u8f6f\u5f00\u53d1\u7684\u5f00\u6e90\u6587\u672c\u7f16\u8f91\u5668\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\u7684\u5f00\u53d1\u548c\u8c03\u8bd5\uff0c\u529f\u80fd\u975e\u5e38\u5f3a\u5927\u3002<\/li>\n<li><strong>Spyder<\/strong>\uff1a\u4e00\u6b3e\u4e13\u4e3a\u79d1\u5b66\u8ba1\u7b97\u548c\u6570\u636e\u5206\u6790\u8bbe\u8ba1\u7684Python IDE\uff0c\u96c6\u6210\u4e86\u8bb8\u591a\u6570\u636e\u5206\u6790\u5de5\u5177\u548c\u5e93\u3002<\/li>\n<\/ol>\n<p><h3>\u914d\u7f6ePython\u89e3\u91ca\u5668<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528IDE\u5f00\u53d1Python\u9879\u76ee\u65f6\uff0c\u9700\u8981\u914d\u7f6ePython\u89e3\u91ca\u5668\u3002\u5177\u4f53\u6b65\u9aa4\u6839\u636eIDE\u7684\u4e0d\u540c\u6709\u6240\u5dee\u5f02\uff0c\u4e00\u822c\u53ef\u4ee5\u5728\u9879\u76ee\u8bbe\u7f6e\u6216\u9996\u9009\u9879\u4e2d\u627e\u5230Python\u89e3\u91ca\u5668\u914d\u7f6e\u9009\u9879\u3002<\/p>\n<\/p>\n<p><h3>\u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/h3>\n<\/p>\n<p><p>\u5728\u4f7f\u7528IDE\u5f00\u53d1Python\u9879\u76ee\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6709\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u65e0\u6cd5\u8bc6\u522bPython\u89e3\u91ca\u5668<\/strong>\uff1a\u786e\u4fddPython\u89e3\u91ca\u5668\u8def\u5f84\u6b63\u786e\uff0c\u4e14\u5df2\u5b89\u88c5\u76f8\u5e94\u7684Python\u7248\u672c\u3002<\/li>\n<li><strong>\u8c03\u8bd5\u529f\u80fd\u65e0\u6cd5\u4f7f\u7528<\/strong>\uff1a\u786e\u4fdd\u5df2\u6b63\u786e\u914d\u7f6e\u8c03\u8bd5\u5668\uff0c\u4e14\u4ee3\u7801\u4e2d\u6ca1\u6709\u8bed\u6cd5\u9519\u8bef\u3002<\/li>\n<\/ol>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728cmd\u4e2d\u68c0\u67e5Python\u662f\u5426\u5df2\u5b89\u88c5\uff1f<\/strong><br \/>\u8981\u786e\u5b9aPython\u662f\u5426\u5df2\u5b89\u88c5\u5728\u60a8\u7684\u8ba1\u7b97\u673a\u4e0a\uff0c\u53ef\u4ee5\u5728cmd\u4e2d\u8f93\u5165<code>python --version<\/code>\u6216<code>python -V<\/code>\u3002\u5982\u679cPython\u5df2\u6210\u529f\u5b89\u88c5\uff0c\u60a8\u5c06\u770b\u5230\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\u3002\u5982\u679c\u7cfb\u7edf\u63d0\u793a\u201c\u4e0d\u662f\u5185\u90e8\u6216\u5916\u90e8\u547d\u4ee4\u201d\uff0c\u5219\u8868\u660ePython\u5c1a\u672a\u5b89\u88c5\u6216\u672a\u6b63\u786e\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728cmd\u4e2d\u8fd0\u884cPython\u811a\u672c\uff1f<\/strong><br \/>\u5728cmd\u4e2d\u8fd0\u884cPython\u811a\u672c\u7684\u65b9\u6cd5\u975e\u5e38\u7b80\u5355\u3002\u9996\u5148\uff0c\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u5bfc\u822a\u5230\u5305\u542bPython\u811a\u672c\u7684\u76ee\u5f55\u3002\u7136\u540e\u8f93\u5165<code>python script_name.py<\/code>\uff08\u5c06<code>script_name.py<\/code>\u66ff\u6362\u4e3a\u60a8\u7684\u811a\u672c\u6587\u4ef6\u540d\uff09\uff0c\u6309\u4e0b\u56de\u8f66\u952e\u5373\u53ef\u6267\u884c\u8be5\u811a\u672c\u3002\u786e\u4fdd\u5728\u8fd0\u884c\u4e4b\u524d\u811a\u672c\u6587\u4ef6\u5df2\u6b63\u786e\u4fdd\u5b58\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728cmd\u4e2d\u4f7f\u7528\u865a\u62df\u73af\u5883\u8fd0\u884cPython\uff1f<\/strong><br \/>\u521b\u5efa\u548c\u4f7f\u7528\u865a\u62df\u73af\u5883\u53ef\u4ee5\u5e2e\u52a9\u60a8\u7ba1\u7406Python\u9879\u76ee\u7684\u4f9d\u8d56\u5173\u7cfb\u3002\u5728cmd\u4e2d\uff0c\u9996\u5148\u901a\u8fc7\u547d\u4ee4<code>python -m venv myenv<\/code>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a\u201cmyenv\u201d\u7684\u865a\u62df\u73af\u5883\u3002\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u7684\u547d\u4ee4\u662f<code>myenv\\Scripts\\activate<\/code>\u3002\u6210\u529f\u6fc0\u6d3b\u540e\uff0c\u60a8\u53ef\u4ee5\u5728\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5\u6240\u9700\u7684\u5305\u5e76\u8fd0\u884cPython\u811a\u672c\uff0c\u786e\u4fdd\u9879\u76ee\u7684\u4f9d\u8d56\u5173\u7cfb\u4e0d\u4f1a\u4e0e\u7cfb\u7edf\u8303\u56f4\u5185\u7684Python\u5305\u53d1\u751f\u51b2\u7a81\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728cmd\u6267\u884cPython\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u5b89\u88c5Python\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u9a8c\u8bc1\u5b89\u88c5\u3001\u7f16\u5199Python\u811a\u672c\u3001\u8fd0\u884cPyt [&hellip;]","protected":false},"author":3,"featured_media":1155268,"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\/1155255"}],"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=1155255"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1155255\/revisions"}],"predecessor-version":[{"id":1155271,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1155255\/revisions\/1155271"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1155268"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1155255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1155255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1155255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}