{"id":961014,"date":"2024-12-27T03:54:52","date_gmt":"2024-12-26T19:54:52","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/961014.html"},"modified":"2024-12-27T03:54:54","modified_gmt":"2024-12-26T19:54:54","slug":"windows%e5%a6%82%e4%bd%95%e8%bf%90%e8%a1%8cpython%e8%84%9a%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/961014.html","title":{"rendered":"windows\u5982\u4f55\u8fd0\u884cpython\u811a\u672c"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25103355\/3f7a2945-1acf-4c3d-b5f6-460d6a65c7f9.webp\" alt=\"windows\u5982\u4f55\u8fd0\u884cpython\u811a\u672c\" \/><\/p>\n<p><p> <strong>\u5728Windows\u4e0a\u8fd0\u884cPython\u811a\u672c\u7684\u4e3b\u8981\u65b9\u6cd5\u6709\uff1a\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u3001\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u3001Python\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u3001\u4efb\u52a1\u8ba1\u5212\u7a0b\u5e8f\u3002<\/strong>\u5176\u4e2d\uff0c\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u662f\u6700\u76f4\u63a5\u548c\u5e38\u7528\u7684\u65b9\u6cd5\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u8fd0\u884cPython\u811a\u672c\u3002<\/p>\n<\/p>\n<p><p>\u8981\u5728Windows\u4e0a\u8fd0\u884cPython\u811a\u672c\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5df2\u5b89\u88c5Python\u3002\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5\u9002\u7528\u4e8eWindows\u7684Python\u7248\u672c\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u786e\u4fdd\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u76f4\u63a5\u4f7f\u7528Python\u547d\u4ee4\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26<\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u8fd0\u884cPython\u811a\u672c\u662f\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u4e4b\u4e00\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26<\/strong><br \/>\u6309\u4e0bWin + R\u952e\uff0c\u8f93\u5165\u201ccmd\u201d\u5e76\u6309Enter\u952e\uff0c\u6216\u8005\u5728\u5f00\u59cb\u83dc\u5355\u4e2d\u641c\u7d22\u201c\u547d\u4ee4\u63d0\u793a\u7b26\u201d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5bfc\u822a\u5230\u811a\u672c\u6240\u5728\u76ee\u5f55<\/strong><br \/>\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u5207\u6362\u5230Python\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u3002\u4f8b\u5982\uff0c\u5982\u679c\u811a\u672c\u4f4d\u4e8e\u201cC:\\Scripts\u201d\u76ee\u5f55\u4e0b\uff0c\u53ef\u4ee5\u8f93\u5165<code>cd C:\\Scripts<\/code>\u5e76\u6309Enter\u952e\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884cPython\u811a\u672c<\/strong><br \/>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165<code>python script_name.py<\/code>\uff0c\u5176\u4e2d<code>script_name.py<\/code>\u662fPython\u811a\u672c\u7684\u6587\u4ef6\u540d\u3002\u6309Enter\u952e\u6267\u884c\u811a\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09<\/p>\n<\/p>\n<p><p>\u96c6\u6210\u5f00\u53d1\u73af\u5883\u63d0\u4f9b\u4e86\u66f4\u4fbf\u6377\u7684\u8fd0\u884c\u548c\u8c03\u8bd5Python\u811a\u672c\u7684\u65b9\u6cd5\u3002\u4ee5\u4e0b\u662f\u5e38\u7528\u7684IDE\u53ca\u5176\u4f7f\u7528\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>PyCharm<\/strong><br \/>PyCharm\u662fJetBr<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>ns\u63d0\u4f9b\u7684\u5f3a\u5927IDE\uff0c\u9002\u7528\u4e8ePython\u5f00\u53d1\u3002\u5b89\u88c5\u540e\uff0c\u6253\u5f00PyCharm\u5e76\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Python\u9879\u76ee\u3002\u5c06Python\u811a\u672c\u6587\u4ef6\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d\uff0c\u7136\u540e\u70b9\u51fb\u8fd0\u884c\u6309\u94ae\u5373\u53ef\u6267\u884c\u811a\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Visual Studio Code<\/strong><br \/>Visual Studio Code\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\u3002\u5b89\u88c5Python\u6269\u5c55\u540e\uff0c\u53ef\u4ee5\u5728\u7f16\u8f91\u5668\u4e2d\u76f4\u63a5\u8fd0\u884cPython\u811a\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u4f7f\u7528Python\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668<\/p>\n<\/p>\n<p><p>Python\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u5141\u8bb8\u5728\u4e0d\u521b\u5efa\u6587\u4ef6\u7684\u60c5\u51b5\u4e0b\u76f4\u63a5\u8fd0\u884cPython\u4ee3\u7801\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00Python\u89e3\u91ca\u5668<\/strong><br \/>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165<code>python<\/code>\u5e76\u6309Enter\u952e\u3002\u8fd9\u5c06\u542f\u52a8Python\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8f93\u5165\u548c\u6267\u884c\u4ee3\u7801<\/strong><br \/>\u5728\u89e3\u91ca\u5668\u4e2d\u8f93\u5165Python\u4ee3\u7801\uff0c\u5e76\u6309Enter\u952e\u6267\u884c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u4f7f\u7528\u4efb\u52a1\u8ba1\u5212\u7a0b\u5e8f<\/p>\n<\/p>\n<p><p>Windows\u4efb\u52a1\u8ba1\u5212\u7a0b\u5e8f\u5141\u8bb8\u81ea\u52a8\u5316\u8fd0\u884cPython\u811a\u672c\u3002\u4ee5\u4e0b\u662f\u8bbe\u7f6e\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u4efb\u52a1\u8ba1\u5212\u7a0b\u5e8f<\/strong><br \/>\u5728\u5f00\u59cb\u83dc\u5355\u4e2d\u641c\u7d22\u201c\u4efb\u52a1\u8ba1\u5212\u7a0b\u5e8f\u201d\u5e76\u6253\u5f00\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u521b\u5efa\u57fa\u672c\u4efb\u52a1<\/strong><br \/>\u5728\u4efb\u52a1\u8ba1\u5212\u7a0b\u5e8f\u4e2d\uff0c\u70b9\u51fb\u201c\u521b\u5efa\u57fa\u672c\u4efb\u52a1\u201d\u3002\u6309\u7167\u5411\u5bfc\u63d0\u793a\u8bbe\u7f6e\u4efb\u52a1\u540d\u79f0\u3001\u89e6\u53d1\u5668\u548c\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6307\u5b9aPython\u811a\u672c\u8def\u5f84<\/strong><br \/>\u5728\u64cd\u4f5c\u6b65\u9aa4\u4e2d\uff0c\u9009\u62e9\u201c\u542f\u52a8\u7a0b\u5e8f\u201d\uff0c\u5e76\u8f93\u5165Python\u89e3\u91ca\u5668\u7684\u8def\u5f84\u548c\u811a\u672c\u6587\u4ef6\u7684\u8def\u5f84\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5728Windows\u4e0a\u9ad8\u6548\u5730\u8fd0\u884cPython\u811a\u672c\u3002\u65e0\u8bba\u662f\u7b80\u5355\u7684\u547d\u4ee4\u63d0\u793a\u7b26\u64cd\u4f5c\uff0c\u8fd8\u662f\u590d\u6742\u7684IDE\u4f7f\u7528\uff0c\u7528\u6237\u90fd\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u9009\u62e9\u6700\u5408\u9002\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Windows\u4e0a\u5b89\u88c5Python\u4ee5\u8fd0\u884c\u811a\u672c\uff1f<\/strong><br \/>\u8981\u5728Windows\u4e0a\u8fd0\u884cPython\u811a\u672c\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u3002\u53ef\u4ee5\u4ecePython\u7684\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684Python\u5b89\u88c5\u7a0b\u5e8f\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u786e\u4fdd\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u6837\u53ef\u4ee5\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u76f4\u63a5\u4f7f\u7528Python\u547d\u4ee4\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u901a\u8fc7\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u8f93\u5165<code>python --version<\/code>\u6765\u786e\u8ba4\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<p><strong>\u5728Windows\u4e0a\u5982\u4f55\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u8fd0\u884cPython\u811a\u672c\uff1f<\/strong><br \/>\u8981\u8fd0\u884cPython\u811a\u672c\uff0c\u9996\u5148\u9700\u8981\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u5f00\u59cb\u83dc\u5355\u4e2d\u641c\u7d22\u201ccmd\u201d\u627e\u5230\u5e76\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\uff0c\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u5207\u6362\u5230\u5305\u542bPython\u811a\u672c\u7684\u76ee\u5f55\u3002\u4f8b\u5982\uff0c\u5982\u679c\u811a\u672c\u4fdd\u5b58\u5728\u201cC:\\scripts\u201d\u6587\u4ef6\u5939\u4e2d\uff0c\u53ef\u4ee5\u8f93\u5165<code>cd C:\\scripts<\/code>\u3002\u63a5\u7740\uff0c\u8f93\u5165<code>python script_name.py<\/code>\u6765\u8fd0\u884c\u7279\u5b9a\u7684Python\u811a\u672c\u3002<\/p>\n<p><strong>\u5982\u4f55\u5904\u7406\u5728Windows\u4e0a\u8fd0\u884cPython\u811a\u672c\u65f6\u9047\u5230\u7684\u9519\u8bef\uff1f<\/strong><br \/>\u5728\u8fd0\u884cPython\u811a\u672c\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u5404\u79cd\u9519\u8bef\u3002\u5e38\u89c1\u7684\u9519\u8bef\u5305\u62ec\u8bed\u6cd5\u9519\u8bef\u3001\u6a21\u5757\u672a\u627e\u5230\u9519\u8bef\u7b49\u3002\u4e3a\u4e86\u66f4\u597d\u5730\u89e3\u51b3\u8fd9\u4e9b\u95ee\u9898\uff0c\u53ef\u4ee5\u4ed4\u7ec6\u9605\u8bfb\u9519\u8bef\u6d88\u606f\uff0c\u901a\u5e38\u5b83\u4eec\u4f1a\u6307\u660e\u95ee\u9898\u51fa\u5728\u54ea\u91cc\u3002\u786e\u4fdd\u6240\u6709\u4f9d\u8d56\u7684\u5e93\u5df2\u7ecf\u5b89\u88c5\uff0c\u5e76\u4e14\u4f7f\u7528<code>pip install package_name<\/code>\u547d\u4ee4\u5b89\u88c5\u7f3a\u5931\u7684\u6a21\u5757\u3002\u5982\u679c\u9519\u8bef\u4f9d\u7136\u5b58\u5728\uff0c\u53ef\u4ee5\u5728\u7f51\u4e0a\u641c\u7d22\u9519\u8bef\u6d88\u606f\u4ee5\u627e\u5230\u89e3\u51b3\u65b9\u6848\uff0c\u6216\u8005\u5728Python\u793e\u533a\u5bfb\u6c42\u5e2e\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Windows\u4e0a\u8fd0\u884cPython\u811a\u672c\u7684\u4e3b\u8981\u65b9\u6cd5\u6709\uff1a\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u3001\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u3001Python\u4ea4\u4e92\u5f0f [&hellip;]","protected":false},"author":3,"featured_media":961020,"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\/961014"}],"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=961014"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/961014\/revisions"}],"predecessor-version":[{"id":961024,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/961014\/revisions\/961024"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/961020"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=961014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=961014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=961014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}