{"id":19874,"date":"2024-11-19T14:11:15","date_gmt":"2024-11-19T06:11:15","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19874\/"},"modified":"2024-11-19T14:11:15","modified_gmt":"2024-11-19T06:11:15","slug":"vscode%e6%80%8e%e4%b9%88%e8%bf%9c%e7%a8%8b%e8%b0%83%e8%af%95python%e4%bb%a3%e7%a0%81%ef%bc%9f%e6%96%b9%e6%b3%95%e6%95%b4%e7%90%86","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19874\/","title":{"rendered":"vscode\u600e\u4e48\u8fdc\u7a0b\u8c03\u8bd5python\u4ee3\u7801\uff1f\u65b9\u6cd5\u6574\u7406"},"content":{"rendered":"<p>\u5728\u300a\/512421.html&#8221; target=&#8221;_self&#8221; title=&#8221;\u4e00\u6587\u638c\u63e1vscode\u8fdc\u7a0bgdb\u8c03\u8bd5&#8221; textvalue=&#8221;vscode\u8fdc\u7a0bgdb\u8c03\u8bd5&#8221;&gt;vscode\u8fdc\u7a0bgdb\u8c03\u8bd5\u300b\u6587\u7ae0\u4e2d\uff0c\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528 vscode \u8c03\u8bd5 c\/c++ \u4ee3\u7801\uff0c\u4f5c\u4e3a\u8be5\u6587\u7684\u59ca\u59b9\u7bc7\uff0c\u672c\u6587\u5bf9\u8c03\u8bd5  \u4ee3\u7801\u7684\u65b9\u6cd5\u505a\u4e00\u4e2a\u6574\u7406\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/6436810590532761.jpg\" class=\"aligncenter\" title=\"vscode\u600e\u4e48\u8fdc\u7a0b\u8c03\u8bd5python\u4ee3\u7801\uff1f\u65b9\u6cd5\u6574\u7406\u63d2\u56fe\" alt=\"vscode\u600e\u4e48\u8fdc\u7a0b\u8c03\u8bd5python\u4ee3\u7801\uff1f\u65b9\u6cd5\u6574\u7406\u63d2\u56fe\" \/><\/p>\n<h2><strong>\u73af\u5883\u914d\u7f6e<\/strong><\/h2>\n<p>\u8fdc\u7a0b\u8fde\u63a5\u7684\u65b9\u6cd5\u540c&nbsp;\u300a\u300b\u4e2d\u7684\u7b2c 1 \u8282\u76f8\u540c\uff0c\u672c\u6587\u4e0d\u8d58\u8ff0\uff0c\u4e0d\u719f\u6089\u7684\u53ef\u4ee5\u53c2\u8003\u90a3\u7bc7\u6587\u7ae0\u3002<\/p>\n<h2><strong>\u914d\u7f6e python \u73af\u5883<\/strong><\/h2>\n<p>\u51c6\u5907\u4e00\u6bb5 python \u4ee3\u7801<\/p>\n<pre>from __future__ import print_function\n\ndef sum_nums(n):\n    s=0\n    for i in range(n):\n        s += i\n        print(s)\n \nif __name__ == '__main__':\n    sum_nums(5)<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\u5728\u5de6\u4fa7\u8fd0\u884c\u548c\u8c03\u8bd5\u6309\u94ae\u4e2d\uff0c\u70b9\u51fb\u201c\u521b\u5efalaunch.json\u201d\u6587\u4ef6\uff0c\u9009\u62e9 python\u6587\u4ef6\uff08\u5982\u679c\u6ca1\u6709\u7684\u8bdd\u9700\u8981\u5148\u5b89\u88c5 python \u6269\u5c55\uff0c\u5728\u5e94\u7528\u4e2d\u641c\u7d22 python \u7b2c\u4e00\u4e2a\u5b89\u88c5\u4e86\u6700\u591a\u7684\u5373\u53ef\uff09\u3010\u63a8\u8350\u5b66\u4e60\uff1a\u3001\u3011<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/dce785ce4b5289cd5dbdc6d7703d15d5-0.png\" class=\"aligncenter\" title=\"vscode\u600e\u4e48\u8fdc\u7a0b\u8c03\u8bd5python\u4ee3\u7801\uff1f\u65b9\u6cd5\u6574\u7406\u63d2\u56fe1\" alt=\"vscode\u600e\u4e48\u8fdc\u7a0b\u8c03\u8bd5python\u4ee3\u7801\uff1f\u65b9\u6cd5\u6574\u7406\u63d2\u56fe1\" \/><\/p>\n<p>&nbsp;\u9009\u62e9 python \u6587\u4ef6<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/6c70d579bafbffb2ee42cd86f1bf34aa-1.png\" class=\"aligncenter\" title=\"vscode\u600e\u4e48\u8fdc\u7a0b\u8c03\u8bd5python\u4ee3\u7801\uff1f\u65b9\u6cd5\u6574\u7406\u63d2\u56fe2\" alt=\"vscode\u600e\u4e48\u8fdc\u7a0b\u8c03\u8bd5python\u4ee3\u7801\uff1f\u65b9\u6cd5\u6574\u7406\u63d2\u56fe2\" \/><\/p>\n<p>&nbsp;\u751f\u6210\u9ed8\u8ba4\u7684 launch \u6587\u4ef6\u5982\u4e0b<\/p>\n<pre>{\n    \/\/ \u4f7f\u7528 IntelliSense \u4e86\u89e3\u76f8\u5173\u5c5e\u6027\u3002 \n    \/\/ \u60ac\u505c\u4ee5\u67e5\u770b\u73b0\u6709\u5c5e\u6027\u7684\u63cf\u8ff0\u3002\n    \/\/ \u6b32\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u8bbf\u95ee: https:\/\/go.microsoft.com\/fwlink\/?linkid=830387\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"name\": \"Python: \u5f53\u524d\u6587\u4ef6\",\n            \"type\": \"python\",\n            \"request\": \"launch\",\n            \"program\": \"${file}\",\n            \"console\": \"integratedTerminal\",\n            \"justMyCode\": true\n        }\n    ]\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u91cc\u6211\u4eec\u9700\u8981\u81ea\u5b9a\u4e49\u6307\u5b9a\u4e00\u4e0b\u7528\u5230\u7684 python \u7248\u672c\uff0c\u9700\u8981\u6dfb\u52a0 \u201cpythonPath\u201d \u9009\u9879<\/p>\n<pre>{\n    \/\/ \u4f7f\u7528 IntelliSense \u4e86\u89e3\u76f8\u5173\u5c5e\u6027\u3002 \n    \/\/ \u60ac\u505c\u4ee5\u67e5\u770b\u73b0\u6709\u5c5e\u6027\u7684\u63cf\u8ff0\u3002\n    \/\/ \u6b32\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u8bbf\u95ee: https:\/\/go.microsoft.com\/fwlink\/?linkid=830387\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"name\": \"Python: \u5f53\u524d\u6587\u4ef6\",\n            \"type\": \"python\",\n            \"pythonPath\": \"\/home\/lthpc\/anaconda3\/bin\/python3.7\",\n            \"request\": \"launch\",\n            \"program\": \"${file}\",\n            \"console\": \"integratedTerminal\",\n            \"justMyCode\": true\n        }\n    ]\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u6837\u7684\u8bdd\u5c31\u53ef\u4ee5\u4f7f\u7528\u6307\u5b9a\u7684 python \u8fd0\u884c\u4ee3\u7801\u4e86<\/p>\n<p>\u5982\u679c\u8bf4\u7528\u5230\u4e86 conda \u865a\u62df\u73af\u5883\uff0c\u5219\u9700\u8981\u627e\u5230\u865a\u62df\u73af\u5883\u5bf9\u5e94\u7684 python \u8def\u5f84\uff0c\u53ef\u4ee5\u4f7f\u7528 whereis python \u67e5\u770b\uff0c\u6bd4\u5982<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/6c70d579bafbffb2ee42cd86f1bf34aa-2.png\" class=\"aligncenter\" title=\"vscode\u600e\u4e48\u8fdc\u7a0b\u8c03\u8bd5python\u4ee3\u7801\uff1f\u65b9\u6cd5\u6574\u7406\u63d2\u56fe3\" alt=\"vscode\u600e\u4e48\u8fdc\u7a0b\u8c03\u8bd5python\u4ee3\u7801\uff1f\u65b9\u6cd5\u6574\u7406\u63d2\u56fe3\" \/><\/p>\n<h2><strong>\u8c03\u8bd5\u4ee3\u7801<\/strong><\/h2>\n<p>\u914d\u7f6e\u597d\u8c03\u8bd5\u73af\u5883\u540e\uff0c\u5728\u4ee3\u7801\u4e2d\u6253\u4e0a\u65ad\u70b9\uff0c\u7136\u540e\u70b9\u51fb\u8fd0\u884c\u8c03\u8bd5\u548c\u6267\u884c\u6309\u94ae\uff0c\u5373\u53ef\u8fdb\u5165\u8c03\u8bd5\u9875\u9762<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/6f00579eefa1a60fd5eceedfd0bd68d1-3.png\" class=\"aligncenter\" title=\"vscode\u600e\u4e48\u8fdc\u7a0b\u8c03\u8bd5python\u4ee3\u7801\uff1f\u65b9\u6cd5\u6574\u7406\u63d2\u56fe4\" alt=\"vscode\u600e\u4e48\u8fdc\u7a0b\u8c03\u8bd5python\u4ee3\u7801\uff1f\u65b9\u6cd5\u6574\u7406\u63d2\u56fe4\" \/><\/p>\n<p>\u5176\u4f59\u7684\u64cd\u4f5c\u5c31\u5f88\u719f\u6089\u4e86\uff0c\u4e0d\u518d\u8d58\u8ff0<\/p>\n<p>\u66f4\u591a\u5173\u4e8eVSCode\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u8bf7\u8bbf\u95ee\uff1a\uff01<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u8fdc\u7a0b\u8c03\u8bd5\u4ee3\u7801\uff1f\u65b9\u6cd5\u6574\u7406\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\u300a\/512421.html&#8221; target=&#8221;_self&#8221; title=&#8221;\u4e00\u6587\u638c\u63e1vscode\u8fdc\u7a0bgdb\u8c03\u8bd5&#8221; textvalue=&#8221;vscode\u8fdc\u7a0bgdb\u8c03\u8bd5&#8221;&gt;vscode\u8fdc\u7a0bgdb\u8c03\u8bd5\u300b\u6587\u7ae0\u4e2d\uff0c\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528 vscode \u8c03\u8bd5 c\/c++ \u4ee3\u7801\uff0c\u4f5c\u4e3a\u8be5\u6587\u7684\u59ca\u59b9\u7bc7\uff0c\u672c\u6587\u5bf9\u8c03\u8bd5 \u4ee3\u7801\u7684\u65b9\u6cd5\u505a\u4e00\u4e2a\u6574\u7406\u3002 \u73af\u5883\u914d\u7f6e \u8fdc\u7a0b\u8fde\u63a5\u7684\u65b9\u6cd5\u540c&nbsp;\u300a\u300b\u4e2d\u7684\u7b2c 1 \u8282\u76f8\u540c\uff0c\u672c\u6587\u4e0d\u8d58\u8ff0\uff0c\u4e0d\u719f\u6089\u7684\u53ef\u4ee5\u53c2\u8003\u90a3\u7bc7\u6587\u7ae0\u3002 \u914d\u7f6e python \u73af\u5883 \u51c6\u5907\u4e00\u6bb5 python \u4ee3\u7801 from __future__ import print_function def sum_nums(n): s=0 for i in range(n): s += i print(s) if __name__ == &#8216;__main__&#8217;: sum_nums(5) \u767b\u5f55\u540e\u590d\u5236 \u7136\u540e\u5728\u5de6\u4fa7\u8fd0\u884c\u548c\u8c03\u8bd5\u6309\u94ae\u4e2d\uff0c\u70b9\u51fb\u201c\u521b\u5efalaunch.json\u201d\u6587\u4ef6\uff0c\u9009\u62e9 python\u6587\u4ef6\uff08\u5982\u679c\u6ca1\u6709\u7684\u8bdd\u9700\u8981\u5148\u5b89\u88c5 python \u6269\u5c55\uff0c\u5728\u5e94\u7528\u4e2d\u641c\u7d22 python \u7b2c\u4e00\u4e2a\u5b89\u88c5\u4e86\u6700\u591a\u7684\u5373\u53ef\uff09\u3010\u63a8\u8350\u5b66\u4e60\uff1a\u3001\u3011 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b &nbsp;\u9009\u62e9 python \u6587\u4ef6 &nbsp;\u751f\u6210\u9ed8\u8ba4\u7684 launch \u6587\u4ef6\u5982\u4e0b { \/\/ [&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-19874","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19874","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=19874"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19874\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19874"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19874"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19874"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}