{"id":21353,"date":"2024-11-19T11:06:35","date_gmt":"2024-11-19T03:06:35","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21353\/"},"modified":"2024-11-19T11:06:35","modified_gmt":"2024-11-19T03:06:35","slug":"vscode%e6%80%8e%e4%b9%88%e9%85%8d%e7%bd%aepython%e8%b7%af%e5%be%84","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21353\/","title":{"rendered":"vscode\u600e\u4e48\u914d\u7f6epython\u8def\u5f84"},"content":{"rendered":"<blockquote><p>\n  \u5982\u4f55\u914d\u7f6e visual studio code \u4e2d\u7684 python \u8def\u5f84\uff1f\u9a8c\u8bc1 python \u662f\u5426\u5df2\u5b89\u88c5\u3002\u5c06 python \u6dfb\u52a0\u5230\u8def\u5f84\uff1awindows\uff1a\u5728 &#8220;\u8def\u5f84&#8221; \u53d8\u91cf\u4e2d\u6dfb\u52a0 python \u89e3\u91ca\u5668\u8def\u5f84\u3002macos\uff1a\u8fd0\u884c &#8220;export path=\/path\/to\/python:$path&#8221; \u547d\u4ee4\u3002linux\uff1a\u8fd0\u884c &#8220;export path=\/path\/to\/python:$path&#8221; \u547d\u4ee4\u3002\u91cd\u542f vs code \u4f7f\u8def\u5f84\u66f4\u6539\u751f\u6548\u3002\u9a8c\u8bc1\u8def\u5f84\u914d\u7f6e\uff1a\u5728 vs code \u7ec8\u7aef\u4e2d\u8fd0\u884c &#8220;which pyt\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/27\/2024052711362082254.jpg\" class=\"aligncenter\" title=\"vscode\u600e\u4e48\u914d\u7f6epython\u8def\u5f84\u63d2\u56fe\" alt=\"vscode\u600e\u4e48\u914d\u7f6epython\u8def\u5f84\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 Visual Studio Code \u4e2d\u914d\u7f6e Python \u8def\u5f84<\/strong><\/p>\n<p>\u4e3a\u4e86\u5728 Visual Studio Code (VS Code) \u4e2d\u4f7f\u7528 Python\uff0c\u60a8\u9700\u8981\u914d\u7f6e Python \u89e3\u91ca\u5668\u7684\u8def\u5f84\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u5b8c\u6210\u6b64\u64cd\u4f5c\uff1a<\/p>\n<p><strong>\u6b65\u9aa4 1\uff1a\u9a8c\u8bc1 Python \u662f\u5426\u5df2\u5b89\u88c5<\/strong><\/p>\n<p>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u68c0\u67e5 Python \u662f\u5426\u5df2\u5b89\u88c5\uff1a<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<pre>python --version<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u6ca1\u6709\u5b89\u88c5 Python\uff0c\u8bf7\u4e0b\u8f7d\u5e76\u5b89\u88c5 Python 3\u3002<\/p>\n<p><strong>\u6b65\u9aa4 2\uff1a\u5c06 Python \u6dfb\u52a0\u5230\u8def\u5f84<\/strong><\/p>\n<p>\u5728 Windows \u4e0a\uff1a<\/p>\n<ul>\n<li>\u6253\u5f00 &#8220;\u63a7\u5236\u9762\u677f&#8221; &gt; &#8220;\u7cfb\u7edf\u548c\u5b89\u5168&#8221; &gt; &#8220;\u7cfb\u7edf&#8221;\u3002<\/li>\n<li>\u70b9\u51fb &#8220;\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e&#8221; \u9009\u9879\u5361\u3002<\/li>\n<li>\u5728 &#8220;\u73af\u5883\u53d8\u91cf&#8221; \u90e8\u5206\u4e2d\uff0c\u5728 &#8220;\u8def\u5f84&#8221; \u53d8\u91cf\u4e2d\u6dfb\u52a0 Python \u89e3\u91ca\u5668\u7684\u8def\u5f84\uff08\u4f8b\u5982\uff0cC:Python39\uff09\u3002<\/li>\n<\/ul>\n<p>\u5728 macOS \u4e0a\uff1a<\/p>\n<ul>\n<li>\u6253\u5f00 &#8220;\u7ec8\u7aef&#8221; \u5e94\u7528\u7a0b\u5e8f\u3002<\/li>\n<li>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/li>\n<\/ul>\n<pre>export PATH=\/path\/to\/python:$PATH<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre>export PATH=\/usr\/local\/bin\/python3:$PATH<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728 Linux \u4e0a\uff1a<\/p>\n<ul>\n<li>\u6253\u5f00\u7ec8\u7aef\u7a97\u53e3\u3002<\/li>\n<li>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/li>\n<\/ul>\n<pre>export PATH=\/path\/to\/python:$PATH<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre>export PATH=\/usr\/bin\/python3:$PATH<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6b65\u9aa4 3\uff1a\u91cd\u542f VS Code<\/strong><\/p>\n<p>\u91cd\u65b0\u542f\u52a8 VS Code \u4ee5\u4f7f\u8def\u5f84\u66f4\u6539\u751f\u6548\u3002<\/p>\n<p><strong>\u6b65\u9aa4 4\uff1a\u9a8c\u8bc1\u8def\u5f84\u914d\u7f6e<\/strong><\/p>\n<p>\u5728 VS Code \u4e2d\uff0c\u6253\u5f00\u4e00\u4e2a\u7ec8\u7aef\u5e76\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>which python<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u5c06\u8f93\u51fa Python \u89e3\u91ca\u5668\u7684\u8def\u5f84\uff0c\u5982\u679c\u914d\u7f6e\u6b63\u786e\uff0c\u5b83\u5e94\u8be5\u662f\u60a8\u4e4b\u524d\u8bbe\u7f6e\u7684\u8def\u5f84\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u914d\u7f6e\u8def\u5f84\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>\u5982\u4f55\u914d\u7f6e visual studio code \u4e2d\u7684 python \u8def\u5f84\uff1f\u9a8c\u8bc1 python \u662f\u5426\u5df2\u5b89\u88c5\u3002\u5c06 python \u6dfb\u52a0\u5230\u8def\u5f84\uff1awindows\uff1a\u5728 &#8220;\u8def\u5f84&#8221; \u53d8\u91cf\u4e2d\u6dfb\u52a0 python \u89e3\u91ca\u5668\u8def\u5f84\u3002macos\uff1a\u8fd0\u884c &#8220;export path=\/path\/to\/python:$path&#8221; \u547d\u4ee4\u3002linux\uff1a\u8fd0\u884c &#8220;export path=\/path\/to\/python:$path&#8221; \u547d\u4ee4\u3002\u91cd\u542f vs code \u4f7f\u8def\u5f84\u66f4\u6539\u751f\u6548\u3002\u9a8c\u8bc1\u8def\u5f84\u914d\u7f6e\uff1a\u5728 vs code \u7ec8\u7aef\u4e2d\u8fd0\u884c &#8220;which pyt \u5982\u4f55\u5728 Visual Studio Code \u4e2d\u914d\u7f6e Python \u8def\u5f84 \u4e3a\u4e86\u5728 Visual Studio Code (VS Code) \u4e2d\u4f7f\u7528 Python\uff0c\u60a8\u9700\u8981\u914d\u7f6e Python \u89e3\u91ca\u5668\u7684\u8def\u5f84\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u5b8c\u6210\u6b64\u64cd\u4f5c\uff1a \u6b65\u9aa4 1\uff1a\u9a8c\u8bc1 Python \u662f\u5426\u5df2\u5b89\u88c5 \u5728\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u68c0\u67e5 Python \u662f\u5426\u5df2\u5b89\u88c5\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b python [&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-21353","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21353","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=21353"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21353\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}