{"id":975362,"date":"2024-12-27T06:12:37","date_gmt":"2024-12-26T22:12:37","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/975362.html"},"modified":"2024-12-27T06:12:40","modified_gmt":"2024-12-26T22:12:40","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8cmd%e4%b8%adpython","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/975362.html","title":{"rendered":"\u5982\u4f55\u5728cmd\u4e2dpython"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24200633\/1f68da36-893a-48f0-8d7c-2d827c19bc8d.webp\" alt=\"\u5982\u4f55\u5728cmd\u4e2dpython\" \/><\/p>\n<p><p> <strong>\u5728CMD\u4e2d\u4f7f\u7528Python\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5df2\u5b89\u88c5Python\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u4e86\u89e3\u57fa\u672c\u547d\u4ee4\u3002<\/strong>\u5b89\u88c5Python\u540e\uff0c\u60a8\u53ef\u4ee5\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u4f7f\u7528Python\u547d\u4ee4\u6765\u8fd0\u884cPython\u811a\u672c\u3001\u8fdb\u5165Python\u4ea4\u4e92\u6a21\u5f0f\u3001\u5b89\u88c5\u548c\u7ba1\u7406Python\u5305\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728CMD\u4e2d\u4f7f\u7528Python\u7684\u5404\u4e2a\u65b9\u9762\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u5b89\u88c5Python<\/p>\n<\/p>\n<p><p>\u5728\u5f00\u59cb\u4f7f\u7528Python\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u5728\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5Python\u3002Python\u7684\u5b98\u65b9\u7f51\u7ad9\u63d0\u4f9b\u4e86\u4e0d\u540c\u7248\u672c\u7684Python\u5b89\u88c5\u7a0b\u5e8f\uff0c\u60a8\u53ef\u4ee5\u6839\u636e\u9700\u8981\u9009\u62e9\u9002\u5408\u7684\u7248\u672c\u8fdb\u884c\u4e0b\u8f7d\u548c\u5b89\u88c5\u3002\u4ee5\u4e0b\u662f\u5b89\u88c5Python\u7684\u4e00\u4e9b\u57fa\u672c\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4e0b\u8f7dPython\u5b89\u88c5\u7a0b\u5e8f<\/strong>\uff1a\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%EF%BC%8C%E5%9C%A8%E4%B8%8B%E8%BD%BD%E9%A1%B5%E9%9D%A2%E9%80%89%E6%8B%A9%E9%80%82%E5%90%88%E6%82%A8%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%9A%84Python%E7%89%88%E6%9C%AC%E3%80%82%E9%80%9A%E5%B8%B8%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\u5728\u4e0b\u8f7d\u9875\u9762\u9009\u62e9\u9002\u5408\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684Python\u7248\u672c\u3002\u901a\u5e38\u5efa\u8bae\u9009\u62e9\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u3002<\/a><\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f<\/strong>\uff1a\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u8fd0\u884cPython\u5b89\u88c5\u7a0b\u5e8f\u3002\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u52a1\u5fc5\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<\/li>\n<li>\n<p><strong>\u5b8c\u6210\u5b89\u88c5<\/strong>\uff1a\u6309\u7167\u5b89\u88c5\u5411\u5bfc\u7684\u6307\u5f15\u5b8c\u6210\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u5728CMD\u4e2d\u8f93\u5165<code>python --version<\/code>\u547d\u4ee4\u6765\u9a8c\u8bc1Python\u662f\u5426\u5df2\u6b63\u786e\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n<\/p>\n<p><p>\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u662f\u786e\u4fdd\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528Python\u547d\u4ee4\u7684\u91cd\u8981\u6b65\u9aa4\u3002\u867d\u7136\u5728\u5b89\u88c5Python\u65f6\u53ef\u4ee5\u81ea\u52a8\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u4f46\u6709\u65f6\u9700\u8981\u624b\u52a8\u786e\u8ba4\u6216\u8c03\u6574\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u7cfb\u7edf\u5c5e\u6027<\/strong>\uff1a\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u201c\u8ba1\u7b97\u673a\u201d\u56fe\u6807\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8bbf\u95ee\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e<\/strong>\uff1a\u5728\u7cfb\u7edf\u5c5e\u6027\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u94fe\u63a5\uff0c\u7136\u540e\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u8f91\u7cfb\u7edf\u53d8\u91cf<\/strong>\uff1a\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u90e8\u5206\uff0c\u627e\u5230\u5e76\u9009\u62e9\u201cPath\u201d\u53d8\u91cf\uff0c\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6dfb\u52a0Python\u8def\u5f84<\/strong>\uff1a\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\uff0c\u786e\u4fddPython\u7684\u5b89\u88c5\u8def\u5f84\u548cScripts\u76ee\u5f55\u5df2\u7ecf\u6dfb\u52a0\u5230\u5217\u8868\u4e2d\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u8def\u5f84\u901a\u5e38\u662f<code>C:\\PythonXX<\/code>\u548c<code>C:\\PythonXX\\Scripts<\/code>\uff08XX\u4ee3\u8868Python\u7248\u672c\u53f7\uff09\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4fdd\u5b58\u5e76\u9000\u51fa<\/strong>\uff1a\u5b8c\u6210\u7f16\u8f91\u540e\uff0c\u4fdd\u5b58\u66f4\u6539\u5e76\u5173\u95ed\u6240\u6709\u7a97\u53e3\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u8fd0\u884cPython\u811a\u672c<\/p>\n<\/p>\n<p><p>\u5728CMD\u4e2d\u8fd0\u884cPython\u811a\u672c\u662f\u4f7f\u7528Python\u7684\u5e38\u89c1\u65b9\u5f0f\u3002\u4ee5\u4e0b\u662f\u8fd0\u884cPython\u811a\u672c\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efaPython\u811a\u672c<\/strong>\uff1a\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08\u5982Notepad++\u3001VSCode\u7b49\uff09\u521b\u5efa\u4e00\u4e2aPython\u811a\u672c\u6587\u4ef6\uff0c\u6587\u4ef6\u6269\u5c55\u540d\u4e3a<code>.py<\/code>\u3002\u4f8b\u5982\uff0c\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>hello.py<\/code>\u7684\u6587\u4ef6\uff0c\u5e76\u5728\u5176\u4e2d\u7f16\u5199\u4e00\u4e9bPython\u4ee3\u7801\uff0c\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello, World!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26<\/strong>\uff1a\u5728Windows\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u6309\u4e0bWin+R\u952e\uff0c\u8f93\u5165<code>cmd<\/code>\u5e76\u6309Enter\u952e\u6765\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5bfc\u822a\u5230\u811a\u672c\u6240\u5728\u76ee\u5f55<\/strong>\uff1a\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u5bfc\u822a\u5230Python\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u3002\u4f8b\u5982\uff0c\u5982\u679c\u811a\u672c\u4f4d\u4e8e\u684c\u9762\uff0c\u53ef\u4ee5\u8f93\u5165\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">cd Desktop<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884cPython\u811a\u672c<\/strong>\uff1a\u8f93\u5165<code>python hello.py<\/code>\u5e76\u6309Enter\u952e\uff0c\u8fd0\u884cPython\u811a\u672c\u3002\u6b64\u65f6\uff0c\u60a8\u5e94\u8be5\u4f1a\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u770b\u5230\u201cHello, World!\u201d\u7684\u8f93\u51fa\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u8fdb\u5165Python\u4ea4\u4e92\u6a21\u5f0f<\/p>\n<\/p>\n<p><p>Python\u4ea4\u4e92\u6a21\u5f0f\u662f\u4e00\u4e2a\u5b9e\u65f6\u6267\u884cPython\u4ee3\u7801\u7684\u73af\u5883\uff0c\u9002\u5408\u7528\u4e8e\u6d4b\u8bd5\u548c\u8c03\u8bd5\u77ed\u5c0f\u7684Python\u4ee3\u7801\u7247\u6bb5\u3002\u4ee5\u4e0b\u662f\u8fdb\u5165Python\u4ea4\u4e92\u6a21\u5f0f\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26<\/strong>\uff1a\u5982\u524d\u6240\u8ff0\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8f93\u5165Python\u547d\u4ee4<\/strong>\uff1a\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165<code>python<\/code>\u5e76\u6309Enter\u952e\uff0c\u5373\u53ef\u8fdb\u5165Python\u4ea4\u4e92\u6a21\u5f0f\u3002\u6b64\u65f6\uff0c\u60a8\u4f1a\u770b\u5230Python\u7248\u672c\u4fe1\u606f\u548c\u63d0\u793a\u7b26<code>&gt;&gt;&gt;<\/code>\uff0c\u8868\u793a\u5df2\u8fdb\u5165\u4ea4\u4e92\u6a21\u5f0f\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6267\u884cPython\u4ee3\u7801<\/strong>\uff1a\u5728\u63d0\u793a\u7b26\u540e\u8f93\u5165\u4efb\u610fPython\u4ee3\u7801\u5e76\u6309Enter\u952e\uff0c\u5373\u53ef\u7acb\u5373\u6267\u884c\u5e76\u663e\u793a\u7ed3\u679c\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">&gt;&gt;&gt; print(&quot;Hello, Python!&quot;)<\/p>\n<p>Hello, Python!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9000\u51fa\u4ea4\u4e92\u6a21\u5f0f<\/strong>\uff1a\u8f93\u5165<code>exit()<\/code>\u6216\u6309Ctrl+Z\u7ec4\u5408\u952e\uff08Windows\uff09\u5e76\u6309Enter\u952e\u5373\u53ef\u9000\u51faPython\u4ea4\u4e92\u6a21\u5f0f\uff0c\u8fd4\u56de\u547d\u4ee4\u63d0\u793a\u7b26\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u5b89\u88c5\u548c\u7ba1\u7406Python\u5305<\/p>\n<\/p>\n<p><p>Python\u7684\u5f3a\u5927\u4e4b\u5904\u5728\u4e8e\u5176\u4e30\u5bcc\u7684\u7b2c\u4e09\u65b9\u5e93\u548c\u6a21\u5757\u3002\u901a\u8fc7Python\u5305\u7ba1\u7406\u5de5\u5177pip\uff0c\u60a8\u53ef\u4ee5\u8f7b\u677e\u5b89\u88c5\u548c\u7ba1\u7406\u8fd9\u4e9b\u5e93\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u68c0\u67e5pip\u662f\u5426\u5df2\u5b89\u88c5<\/strong>\uff1a\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cPython\u5b89\u88c5\u7a0b\u5e8f\u4f1a\u540c\u65f6\u5b89\u88c5pip\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165<code>pip --version<\/code>\u6765\u68c0\u67e5pip\u662f\u5426\u5df2\u6b63\u786e\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5Python\u5305<\/strong>\uff1a\u4f7f\u7528<code>pip install<\/code>\u547d\u4ee4\u5b89\u88c5Python\u5305\u3002\u4f8b\u5982\uff0c\u8981\u5b89\u88c5requests\u5e93\uff0c\u53ef\u4ee5\u8f93\u5165\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">pip install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5378\u8f7dPython\u5305<\/strong>\uff1a\u4f7f\u7528<code>pip uninstall<\/code>\u547d\u4ee4\u5378\u8f7dPython\u5305\u3002\u4f8b\u5982\uff0c\u8981\u5378\u8f7drequests\u5e93\uff0c\u53ef\u4ee5\u8f93\u5165\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">pip uninstall requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5217\u51fa\u5df2\u5b89\u88c5\u7684Python\u5305<\/strong>\uff1a\u4f7f\u7528<code>pip list<\/code>\u547d\u4ee4\u67e5\u770b\u5df2\u5b89\u88c5\u7684\u6240\u6709Python\u5305\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u5e38\u89c1\u95ee\u9898\u548c\u6545\u969c\u6392\u9664<\/p>\n<\/p>\n<p><p>\u5728\u4f7f\u7528CMD\u8fd0\u884cPython\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u53ca\u5176\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Python\u547d\u4ee4\u672a\u627e\u5230<\/strong>\uff1a\u786e\u4fddPython\u5df2\u6b63\u786e\u5b89\u88c5\uff0c\u5e76\u4e14Python\u8def\u5f84\u5df2\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u5982\u679c\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u5c1d\u8bd5\u91cd\u65b0\u542f\u52a8\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u8ba1\u7b97\u673a\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>pip\u547d\u4ee4\u672a\u627e\u5230<\/strong>\uff1a\u540c\u6837\uff0c\u786e\u4fddpip\u5df2\u6b63\u786e\u5b89\u88c5\uff0c\u5e76\u4e14Scripts\u8def\u5f84\u5df2\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6743\u9650\u95ee\u9898<\/strong>\uff1a\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u547d\u4ee4\u63d0\u793a\u7b26\u624d\u80fd\u6267\u884c\u67d0\u4e9b\u547d\u4ee4\u3002\u53f3\u952e\u70b9\u51fb\u547d\u4ee4\u63d0\u793a\u7b26\u56fe\u6807\uff0c\u9009\u62e9\u201c\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u201d\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u9075\u5faa\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u60a8\u5e94\u8be5\u80fd\u591f\u5728CMD\u4e2d\u6709\u6548\u5730\u4f7f\u7528Python\u8fdb\u884c\u5404\u79cd\u64cd\u4f5c\u3002\u65e0\u8bba\u662f\u8fd0\u884cPython\u811a\u672c\u3001\u8fdb\u5165\u4ea4\u4e92\u6a21\u5f0f\uff0c\u8fd8\u662f\u5b89\u88c5\u548c\u7ba1\u7406Python\u5305\uff0c\u638c\u63e1\u8fd9\u4e9b\u57fa\u672c\u6280\u80fd\u90fd\u5c06\u5927\u5927\u63d0\u9ad8\u60a8\u7684Python\u5f00\u53d1\u6548\u7387\u3002\u968f\u7740\u60a8\u5bf9Python\u548c\u547d\u4ee4\u884c\u7684\u719f\u6089\uff0c\u60a8\u5c06\u80fd\u591f\u66f4\u597d\u5730\u5229\u7528\u8fd9\u4e9b\u5de5\u5177\u6765\u5904\u7406\u590d\u6742\u7684\u5f00\u53d1\u4efb\u52a1\u3002<\/p>\n<\/p>\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\u68c0\u67e5\u60a8\u7684\u7cfb\u7edf\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u4e86Python\uff0c\u53ef\u4ee5\u5728CMD\u4e2d\u8f93\u5165<code>python --version<\/code>\u6216<code>python -V<\/code>\u3002\u5982\u679cPython\u5df2\u6b63\u786e\u5b89\u88c5\uff0c\u60a8\u5c06\u770b\u5230Python\u7684\u7248\u672c\u53f7\u3002\u5982\u679c\u672a\u5b89\u88c5\uff0c\u60a8\u5c06\u6536\u5230\u76f8\u5e94\u7684\u9519\u8bef\u63d0\u793a\u3002<\/p>\n<p><strong>\u5728CMD\u4e2d\u5982\u4f55\u8fd0\u884cPython\u811a\u672c\uff1f<\/strong><br \/>\u5728CMD\u4e2d\u8fd0\u884cPython\u811a\u672c\u975e\u5e38\u7b80\u5355\u3002\u60a8\u53ea\u9700\u5bfc\u822a\u5230\u5305\u542b\u8be5\u811a\u672c\u7684\u76ee\u5f55\uff0c\u7136\u540e\u8f93\u5165<code>python script_name.py<\/code>\uff0c\u5176\u4e2d<code>script_name.py<\/code>\u662f\u60a8\u7684Python\u6587\u4ef6\u540d\u3002\u786e\u4fdd\u5728\u547d\u4ee4\u4e2d\u5305\u542b\u6b63\u786e\u7684\u8def\u5f84\u6216\u5728\u5f53\u524d\u76ee\u5f55\u4e2d\u6709\u8be5\u6587\u4ef6\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728CMD\u4e2d\u4f7f\u7528Python\u7684\u865a\u62df\u73af\u5883\uff1f<\/strong><br \/>\u521b\u5efa\u548c\u4f7f\u7528Python\u865a\u62df\u73af\u5883\u53ef\u4ee5\u5e2e\u52a9\u60a8\u7ba1\u7406\u9879\u76ee\u7684\u4f9d\u8d56\u5173\u7cfb\u3002\u5728CMD\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a<code>python -m venv env_name<\/code>\u3002\u66ff\u6362<code>env_name<\/code>\u4e3a\u60a8\u5e0c\u671b\u7684\u865a\u62df\u73af\u5883\u540d\u79f0\u3002\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u7684\u65b9\u6cd5\u662f\u8f93\u5165<code>env_name\\Scripts\\activate<\/code>\uff0c\u5728\u6fc0\u6d3b\u540e\uff0c\u60a8\u53ef\u4ee5\u5b89\u88c5\u548c\u4f7f\u7528\u7279\u5b9a\u4e8e\u8be5\u73af\u5883\u7684\u5305\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728CMD\u4e2d\u4f7f\u7528Python\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5df2\u5b89\u88c5Python\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u4e86\u89e3\u57fa\u672c\u547d\u4ee4\u3002\u5b89\u88c5Python\u540e\uff0c\u60a8 [&hellip;]","protected":false},"author":3,"featured_media":975366,"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\/975362"}],"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=975362"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/975362\/revisions"}],"predecessor-version":[{"id":975367,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/975362\/revisions\/975367"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/975366"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=975362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=975362"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=975362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}