{"id":20522,"date":"2024-11-19T17:12:46","date_gmt":"2024-11-19T09:12:46","guid":{"rendered":"https:\/\/fwq.ai\/blog\/20522\/"},"modified":"2024-11-19T17:12:46","modified_gmt":"2024-11-19T09:12:46","slug":"vscode%e6%80%8e%e4%b9%88%e7%94%a8python%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/20522\/","title":{"rendered":"vscode\u600e\u4e48\u7528python\u73af\u5883"},"content":{"rendered":"<blockquote><p>\n  \u5728 visual studio code \u4e2d\u4f7f\u7528 python \u73af\u5883\uff0c\u9700\u8981\u4f9d\u6b21\uff1a\u5b89\u88c5 python \u89e3\u91ca\u5668\u53ca vscode python \u6269\u5c55\u3002\u521b\u5efa\u5e76\u6fc0\u6d3b python \u865a\u62df\u73af\u5883\u3002\u5b89\u88c5\u6240\u9700 python \u5e93\u3002\u521b\u5efa python \u9879\u76ee\u5e76\u8fd0\u884c\u811a\u672c\u3002\u4f7f\u7528\u65ad\u70b9\u8c03\u8bd5 python \u4ee3\u7801\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/03\/2024040303451882965.jpg\" class=\"aligncenter\" title=\"vscode\u600e\u4e48\u7528python\u73af\u5883\u63d2\u56fe\" alt=\"vscode\u600e\u4e48\u7528python\u73af\u5883\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5728 Visual Studio Code \u4e2d\u4f7f\u7528 Python \u73af\u5883<\/strong><\/p>\n<p>Visual Studio Code (VSCode) \u662f\u4e00\u6b3e\u6d41\u884c\u7684\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u5b83\u63d0\u4f9b\u4e86\u5bf9 Python \u73af\u5883\u7684\u51fa\u8272\u652f\u6301\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528 VSCode \u8fdb\u884c Python \u5f00\u53d1\u7684\u5206\u6b65\u6307\u5357\uff1a<\/p>\n<p><strong>1. \u5b89\u88c5 Python \u89e3\u91ca\u5668<\/strong><\/p>\n<ul>\n<li>\u8bbf\u95ee Python \u5b98\u65b9\u7f51\u7ad9\u5e76\u4e0b\u8f7d\u9002\u7528\u4e8e\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684 Python \u89e3\u91ca\u5668\u3002<\/li>\n<li>\u5b89\u88c5\u89e3\u91ca\u5668\u5e76\u786e\u4fdd\u5df2\u5c06 Python \u6dfb\u52a0\u5230\u7cfb\u7edf\u8def\u5f84\u4e2d\u3002<\/li>\n<\/ul>\n<p><strong>2. \u5b89\u88c5 VSCode Python \u6269\u5c55<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<ul>\n<li>\u6253\u5f00 VSCode \u5e76\u8f6c\u5230\u201c\u6269\u5c55\u201d\u5e02\u573a\u3002<\/li>\n<li>\u641c\u7d22\u201cPython\u201d\u6269\u5c55\u5e76\u5b89\u88c5\u5b83\u3002<\/li>\n<\/ul>\n<p><strong>3. \u521b\u5efa Python \u865a\u62df\u73af\u5883<\/strong><\/p>\n<ul>\n<li>\u5728 VSCode \u4e2d\uff0c\u6309 Ctrl + Shift + P\uff08Windows\/Linux\uff09\u6216 Cmd + Shift + P\uff08macOS\uff09\u3002<\/li>\n<li>\u952e\u5165\u201cPython: Create Virtual Environment\u201d\u5e76\u9009\u62e9\u8be5\u9009\u9879\u3002<\/li>\n<li>\u6307\u5b9a\u73af\u5883\u540d\u79f0\u5e76\u9009\u62e9\u4e00\u4e2a\u4f4d\u7f6e\u3002<\/li>\n<\/ul>\n<p><strong>4. \u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/strong><\/p>\n<ul>\n<li>\u5728 VSCode \u4e2d\uff0c\u8f6c\u5230\u201c\u7ec8\u7aef\u201d\u9762\u677f\u3002<\/li>\n<li>\u8f93\u5165 source \/bin\/activate \u6765\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u3002 <\/li>\n<\/ul>\n<p><strong>5. \u5b89\u88c5\u6240\u9700\u5e93<\/strong><\/p>\n<ul>\n<li>\u5728\u7ec8\u7aef\u4e2d\uff0c\u4f7f\u7528 pip \u547d\u4ee4\u5b89\u88c5\u6240\u9700\u7684 Python \u5e93\uff0c\u4f8b\u5982 pip install numpy\u3002<\/li>\n<\/ul>\n<p><strong>6. \u521b\u5efa Python \u9879\u76ee<\/strong><\/p>\n<ul>\n<li>\u5728 VSCode \u4e2d\uff0c\u6309 Ctrl + N\uff08Windows\/Linux\uff09\u6216 Cmd + N\uff08macOS\uff09\u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\u3002<\/li>\n<li>\u4fdd\u5b58\u6587\u4ef6\u4e3a .py \u6269\u5c55\u540d\u3002<\/li>\n<\/ul>\n<p><strong>7. \u8fd0\u884c Python \u811a\u672c<\/strong><\/p>\n<ul>\n<li>\u5728 VSCode \u4e2d\uff0cF5 \u6216\u5355\u51fb\u201c\u8fd0\u884c\u201d\u6309\u94ae\u8fd0\u884c Python \u811a\u672c\u3002<\/li>\n<\/ul>\n<p><strong>8. \u8c03\u8bd5 Python \u4ee3\u7801<\/strong><\/p>\n<ul>\n<li>\u8981\u8c03\u8bd5\u4ee3\u7801\uff0c\u8bf7\u5728\u8981\u8bbe\u7f6e\u65ad\u70b9\u7684\u884c\u4e0a\u5355\u51fb\u9f20\u6807\u5de6\u952e\u5e76\u9009\u62e9\u201c\u65ad\u70b9\u201d\u3002<\/li>\n<li>\u6309 F5 \u5f00\u59cb\u8c03\u8bd5\u3002<\/li>\n<\/ul>\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u786e\u4fdd\u5728\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\u5b89\u88c5\u5e93\u3002<\/li>\n<li>\u5bf9\u4e8e\u5927\u578b\u9879\u76ee\uff0c\u5efa\u8bae\u4f7f\u7528\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u4f8b\u5982 Git\u3002<\/li>\n<li>\u4f7f\u7528 VSCode \u7684\u201cPython \u4ea4\u4e92\u5f0f\u7a97\u53e3\u201d\u6765\u5feb\u901f\u6267\u884c Python \u8bed\u53e5\u3002<\/li>\n<li>\u67e5\u770b VSCode \u7684\u5b98\u65b9\u6587\u6863\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u7528\u73af\u5883\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 visual studio code \u4e2d\u4f7f\u7528 python \u73af\u5883\uff0c\u9700\u8981\u4f9d\u6b21\uff1a\u5b89\u88c5 python \u89e3\u91ca\u5668\u53ca vscode python \u6269\u5c55\u3002\u521b\u5efa\u5e76\u6fc0\u6d3b python \u865a\u62df\u73af\u5883\u3002\u5b89\u88c5\u6240\u9700 python \u5e93\u3002\u521b\u5efa python \u9879\u76ee\u5e76\u8fd0\u884c\u811a\u672c\u3002\u4f7f\u7528\u65ad\u70b9\u8c03\u8bd5 python \u4ee3\u7801\u3002 \u5728 Visual Studio Code \u4e2d\u4f7f\u7528 Python \u73af\u5883 Visual Studio Code (VSCode) \u662f\u4e00\u6b3e\u6d41\u884c\u7684\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u5b83\u63d0\u4f9b\u4e86\u5bf9 Python \u73af\u5883\u7684\u51fa\u8272\u652f\u6301\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528 VSCode \u8fdb\u884c Python \u5f00\u53d1\u7684\u5206\u6b65\u6307\u5357\uff1a 1. \u5b89\u88c5 Python \u89e3\u91ca\u5668 \u8bbf\u95ee Python \u5b98\u65b9\u7f51\u7ad9\u5e76\u4e0b\u8f7d\u9002\u7528\u4e8e\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684 Python \u89e3\u91ca\u5668\u3002 \u5b89\u88c5\u89e3\u91ca\u5668\u5e76\u786e\u4fdd\u5df2\u5c06 Python \u6dfb\u52a0\u5230\u7cfb\u7edf\u8def\u5f84\u4e2d\u3002 2. \u5b89\u88c5 VSCode Python \u6269\u5c55 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-20522","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20522","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=20522"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20522\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=20522"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=20522"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=20522"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}