{"id":20524,"date":"2024-11-19T09:31:45","date_gmt":"2024-11-19T01:31:45","guid":{"rendered":"https:\/\/fwq.ai\/blog\/20524\/"},"modified":"2024-11-19T09:31:45","modified_gmt":"2024-11-19T01:31:45","slug":"vscode%e6%80%8e%e4%b9%88%e9%85%8d%e7%bd%aepython%e8%bf%90%e8%a1%8c%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/20524\/","title":{"rendered":"vscode\u600e\u4e48\u914d\u7f6epython\u8fd0\u884c\u73af\u5883"},"content":{"rendered":"<blockquote><p>\n  \u8981\u914d\u7f6e vs code \u4e2d\u7684 python \u8fd0\u884c\u73af\u5883\uff0c\u8bf7\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u5b89\u88c5 python \u89e3\u91ca\u5668\u3002\u5b89\u88c5 vs code python \u6269\u5c55\u3002\u9009\u62e9 python \u89e3\u91ca\u5668\uff0c\u6216\u901a\u8fc7 &#8220;\u66f4\u591a&#8230;&#8221; \u6765\u81ea\u52a8\u68c0\u6d4b\u3002\u5982\u679c python \u4e0d\u5728\u7cfb\u7edf\u9ed8\u8ba4\u8def\u5f84\u4e2d\uff0c\u5219\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u521b\u5efa\u4e00\u4e2a python \u6587\u4ef6\u5e76\u8fd0\u884c\uff0c\u4ee5\u9a8c\u8bc1\u914d\u7f6e\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/03\/2024040303512029595.jpg\" class=\"aligncenter\" title=\"vscode\u600e\u4e48\u914d\u7f6epython\u8fd0\u884c\u73af\u5883\u63d2\u56fe\" alt=\"vscode\u600e\u4e48\u914d\u7f6epython\u8fd0\u884c\u73af\u5883\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u914d\u7f6e VS Code \u4e2d\u7684 Python \u8fd0\u884c\u73af\u5883<\/strong><\/p>\n<p>\u8981\u914d\u7f6e VS Code \u4e2d\u7684 Python \u8fd0\u884c\u73af\u5883\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>1. \u5b89\u88c5 Python \u89e3\u91ca\u5668<\/strong><\/p>\n<ul>\n<li>\u786e\u8ba4\u5df2\u5728\u7cfb\u7edf\u4e2d\u5b89\u88c5\u4e86 Python \u89e3\u91ca\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u68c0\u67e5\uff1a &#8211;version\u3002<\/li>\n<li>\u5982\u679c\u672a\u5b89\u88c5\uff0c\u8bf7\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7684 Python \u53d1\u884c\u7248\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>\u5728 VS Code \u4e2d\uff0c\u8f6c\u5230\u6269\u5c55\u5e02\u573a\u5e76\u641c\u7d22 &#8220;Python&#8221;\u3002<\/li>\n<li>\u5b89\u88c5 &#8220;Python&#8221; \u6269\u5c55\u3002<\/li>\n<\/ul>\n<p><strong>3. \u9009\u62e9 Python \u89e3\u91ca\u5668<\/strong><\/p>\n<ul>\n<li>\u6253\u5f00 VS Code \u4e2d\u7684\u8bbe\u7f6e\uff08File &gt; Preferences &gt; Settings\uff09\u3002<\/li>\n<li>\u5728\u641c\u7d22\u680f\u4e2d\u8f93\u5165 &#8220;Python: Python Path&#8221;\u3002<\/li>\n<li>\u9009\u62e9\u60a8\u5b89\u88c5\u7684 Python \u89e3\u91ca\u5668\u7684\u8def\u5f84\u3002<\/li>\n<li>\u6216\u8005\uff0c\u53ef\u4ee5\u901a\u8fc7\u5355\u51fb &#8220;\u66f4\u591a&#8230;&#8221; \u6309\u94ae\u5e76\u9009\u62e9 &#8220;\u81ea\u52a8\u68c0\u6d4b&#8221; \u6765\u81ea\u52a8\u68c0\u6d4b Python \u89e3\u91ca\u5668\u3002<\/li>\n<\/ul>\n<p><strong>4. \u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/strong><\/p>\n<ul>\n<li>\u5982\u679c Python \u89e3\u91ca\u5668\u4e0d\u5728\u7cfb\u7edf\u9ed8\u8ba4\u8def\u5f84\u4e2d\uff0c\u5219\u9700\u8981\u4e3a\u5176\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002<\/li>\n<li>\u5728 Windows \u7cfb\u7edf\u4e2d\uff0c\u8f6c\u5230 &#8220;\u63a7\u5236\u9762\u677f &gt; \u7cfb\u7edf\u548c\u5b89\u5168 &gt; \u7cfb\u7edf &gt; \u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e &gt; \u73af\u5883\u53d8\u91cf&#8221;\u3002<\/li>\n<li>\u5728 &#8220;\u8def\u5f84&#8221; \u53d8\u91cf\u4e2d\u6dfb\u52a0 Python \u89e3\u91ca\u5668\u76ee\u5f55\u7684\u8def\u5f84\u3002<\/li>\n<li>\u5728 macOS \u7cfb\u7edf\u4e2d\uff0c\u6253\u5f00 &#8220;\u7ec8\u7aef&#8221; \u5e76\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1aexport PATH=&#8221;\/usr\/local\/bin:$PATH&#8221;<\/li>\n<\/ul>\n<p><strong>5. \u9a8c\u8bc1\u914d\u7f6e<\/strong><\/p>\n<ul>\n<li>\u5728 VS Code \u4e2d\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 Python \u6587\u4ef6\u5e76\u8f93\u5165\u4ee5\u4e0b\u4ee3\u7801\uff1aprint(&#8220;Hello, world!&#8221;)\u3002<\/li>\n<li>\u6309 F5 \u952e\u8fd0\u884c\u7a0b\u5e8f\u3002<\/li>\n<li>\u5e94\u8be5\u5728\u8f93\u51fa\u7a97\u53e3\u4e2d\u770b\u5230 &#8220;Hello, world!&#8221;\u3002<\/li>\n<\/ul>\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u5982\u679c\u9047\u5230\u914d\u7f6e\u95ee\u9898\uff0c\u8bf7\u5c1d\u8bd5\u91cd\u65b0\u542f\u52a8 VS Code\u3002<\/li>\n<li>\u5982\u679c\u65e0\u6cd5\u81ea\u52a8\u68c0\u6d4b Python \u89e3\u91ca\u5668\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528 &#8220;\u66f4\u591a&#8230;&#8221; \u6309\u94ae\u624b\u52a8\u9009\u62e9\u8def\u5f84\u3002<\/li>\n<li>\u786e\u4fdd Python \u73af\u5883\u53d8\u91cf\u5df2\u6b63\u786e\u8bbe\u7f6e\uff0c\u5c24\u5176\u662f\u5f53\u4f7f\u7528\u865a\u62df\u73af\u5883\u65f6\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u914d\u7f6e\u8fd0\u884c\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>\u8981\u914d\u7f6e vs code \u4e2d\u7684 python \u8fd0\u884c\u73af\u5883\uff0c\u8bf7\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u5b89\u88c5 python \u89e3\u91ca\u5668\u3002\u5b89\u88c5 vs code python \u6269\u5c55\u3002\u9009\u62e9 python \u89e3\u91ca\u5668\uff0c\u6216\u901a\u8fc7 &#8220;\u66f4\u591a&#8230;&#8221; \u6765\u81ea\u52a8\u68c0\u6d4b\u3002\u5982\u679c python \u4e0d\u5728\u7cfb\u7edf\u9ed8\u8ba4\u8def\u5f84\u4e2d\uff0c\u5219\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u521b\u5efa\u4e00\u4e2a python \u6587\u4ef6\u5e76\u8fd0\u884c\uff0c\u4ee5\u9a8c\u8bc1\u914d\u7f6e\u3002 \u5982\u4f55\u914d\u7f6e VS Code \u4e2d\u7684 Python \u8fd0\u884c\u73af\u5883 \u8981\u914d\u7f6e VS Code \u4e2d\u7684 Python \u8fd0\u884c\u73af\u5883\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a 1. \u5b89\u88c5 Python \u89e3\u91ca\u5668 \u786e\u8ba4\u5df2\u5728\u7cfb\u7edf\u4e2d\u5b89\u88c5\u4e86 Python \u89e3\u91ca\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u68c0\u67e5\uff1a &#8211;version\u3002 \u5982\u679c\u672a\u5b89\u88c5\uff0c\u8bf7\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7684 Python \u53d1\u884c\u7248\u3002 2. \u5b89\u88c5 VSCode Python \u6269\u5c55 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u5728 VS Code \u4e2d\uff0c\u8f6c\u5230\u6269\u5c55\u5e02\u573a\u5e76\u641c\u7d22 &#8220;Python&#8221;\u3002 \u5b89\u88c5 [&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-20524","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20524","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=20524"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20524\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=20524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=20524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=20524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}