{"id":32198,"date":"2025-04-23T09:01:03","date_gmt":"2025-04-23T01:01:03","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/32198.html"},"modified":"2025-04-23T09:01:03","modified_gmt":"2025-04-23T01:01:03","slug":"vscode%e8%bf%9e%e6%8e%a5%e6%9c%8d%e5%8a%a1%e5%99%a8%e8%b7%91%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0%e4%bb%a3%e7%a0%81%e7%9b%b8%e5%85%b3%e9%97%ae%e9%a2%98%ef%bc%88%e7%a0%940%e5%a4%a7%e6%a8%a1%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/32198.html","title":{"rendered":"VSCode\u8fde\u63a5\u670d\u52a1\u5668\u8dd1\u6df1\u5ea6\u5b66\u4e60\u4ee3\u7801\u76f8\u5173\u95ee\u9898\uff08\u78140\u5927\u6a21\u578b\u5b66\u4e60\u7b2c\u516b\u5929\uff09"},"content":{"rendered":"<h2>VS Code \u8fdc\u7a0b\u8fde\u63a5\u670d\u52a1\u5668&#xff1a;\u4ece\u73af\u5883\u914d\u7f6e\u5230\u4ee3\u7801\u8fd0\u884c\u4e0e\u5e38\u89c1\u95ee\u9898\u89e3\u51b3\u5b9e\u5f55<\/h2>\n<p>\u5728\u4f7f\u7528 VS Code \u901a\u8fc7 Remote-SSH \u8fde\u63a5\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u8fdb\u884c Python \u5f00\u53d1&#xff0c;\u7279\u522b\u662f\u6d89\u53ca Anaconda \u73af\u5883\u548c\u6df1\u5ea6\u5b66\u4e60\u9879\u76ee\u65f6&#xff0c;\u53ef\u80fd\u4f1a\u9047\u5230\u5404\u79cd\u5404\u6837\u7684\u95ee\u9898\u3002\u672c\u6587\u8bb0\u5f55\u5e76\u89e3\u7b54\u4e86\u6211\u5728\u914d\u7f6e\u548c\u8fd0\u884c\u4ee3\u7801\u8fc7\u7a0b\u4e2d\u9047\u5230\u7684\u4e00\u7cfb\u5217\u5177\u4f53\u95ee\u9898&#xff0c;\u5e0c\u671b\u80fd\u4e3a\u4f60\u63d0\u4f9b\u53c2\u8003\u3002<\/p>\n<p>\u6211\u7684\u57fa\u7840\u73af\u5883\u5982\u4e0b&#xff1a;<\/p>\n<ul>\n<li>\u672c\u5730&#xff1a; Visual Studio Code<\/li>\n<li>\u8fdc\u7a0b\u670d\u52a1\u5668&#xff1a; Linux \u7cfb\u7edf&#xff0c;\u901a\u8fc7 VS Code Remote-SSH \u8fde\u63a5<\/li>\n<li>\u670d\u52a1\u5668\u8f6f\u4ef6&#xff1a; \u5b89\u88c5\u4e86 Anaconda<\/li>\n<li>Anaconda \u73af\u5883&#xff1a; \u521b\u5efa\u4e86\u540d\u4e3a pytorch_env \u7684\u865a\u62df\u73af\u5883&#xff0c;\u7528\u4e8e\u6df1\u5ea6\u5b66\u4e60\u3002<\/li>\n<li>VS Code \u63d2\u4ef6&#xff1a; \u5728\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u4e86 VS Code \u7684 Python \u63d2\u4ef6\u548c Jupyter \u76f8\u5173\u63d2\u4ef6\u3002<\/li>\n<\/ul>\n<h4>\u95ee\u9898\u4e00&#xff1a;\u6211\u7684\u6df1\u5ea6\u5b66\u4e60\u4ee3\u7801\u662f\u5199\u5728 .py \u6587\u4ef6\u91cc\u7684&#xff0c;\u5e94\u8be5\u7528 Python \u76f4\u63a5\u8fd0\u884c\u8fd8\u662f\u5728 Jupyter \u4e0a\u8fd0\u884c&#xff1f;<\/h4>\n<p>\u89e3\u7b54&#xff1a;<\/p>\n<p>\u5bf9\u4e8e\u6df1\u5ea6\u5b66\u4e60\u4ee3\u7801\u7684\u5f00\u53d1\u548c\u5b9e\u9a8c\u9636\u6bb5&#xff0c;\u5f3a\u70c8\u63a8\u8350\u5728 Jupyter Notebook (.ipynb) \u6216 VS Code \u7684\u4ea4\u4e92\u5f0f\u7a97\u53e3 (.py \u6587\u4ef6\u914d\u5408) \u4e0a\u8fd0\u884c\u3002<\/p>\n<ul>\n<li>Jupyter Notebook (.ipynb): \u63d0\u4f9b\u5b8c\u6574\u7684\u5355\u5143\u683c\u6267\u884c\u3001\u5185\u8054\u8f93\u51fa\u3001\u56fe\u8868\u663e\u793a\u548c\u6587\u672c\u8bf4\u660e\u529f\u80fd&#xff0c;\u975e\u5e38\u9002\u5408\u63a2\u7d22\u6027\u7f16\u7a0b\u3001\u6570\u636e\u53ef\u89c6\u5316\u548c\u8bb0\u5f55\u5b9e\u9a8c\u8fc7\u7a0b\u3002<\/li>\n<li>VS Code \u4ea4\u4e92\u5f0f\u7a97\u53e3 (.py \u914d\u5408): \u5141\u8bb8\u4f60\u5728 .py \u6587\u4ef6\u4e2d\u5206\u5757\u8fd0\u884c\u4ee3\u7801&#xff0c;\u5e76\u5728\u72ec\u7acb\u7684\u7a97\u53e3\u4e2d\u770b\u5230\u8f93\u51fa\u548c\u56fe\u8868&#xff0c;\u63d0\u4f9b\u4e86\u7c7b\u4f3c Notebook \u7684\u4ea4\u4e92\u6027&#xff0c;\u540c\u65f6\u4fdd\u6301\u4ee3\u7801\u5728 .py \u6587\u4ef6\u4e2d\u3002<\/li>\n<li>\u7eaf Python \u811a\u672c (.py \u5728\u7ec8\u7aef\u8fd0\u884c): \u66f4\u9002\u5408\u4e8e\u4ee3\u7801\u5f00\u53d1\u5b8c\u6210\u540e\u7684\u6700\u7ec8\u8bad\u7ec3\u3001\u6279\u91cf\u5904\u7406\u3001\u81ea\u52a8\u5316\u6216\u96c6\u6210\u5230\u5176\u4ed6\u5e94\u7528\u4e2d\u3002<\/li>\n<\/ul>\n<p>\u9009\u62e9\u54ea\u79cd\u65b9\u5f0f\u53d6\u51b3\u4e8e\u4f60\u7684\u5f53\u524d\u4efb\u52a1\u9636\u6bb5\u3002\u5f00\u53d1\u8c03\u8bd5\u4f18\u5148\u8003\u8651\u4ea4\u4e92\u5f0f\u65b9\u5f0f\u3002<\/p>\n<h4>\u95ee\u9898\u4e8c&#xff1a;\u5982\u679c\u60f3\u5728 Jupyter \u4e0a\u8fd0\u884c&#xff0c;\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\u6709 Jupyter \u5417&#xff1f;\u5e94\u8be5\u5728\u54ea\u4e2a\u73af\u5883\u4e0b\u8fd0\u884c&#xff1f;<\/h4>\n<p>\u89e3\u7b54&#xff1a;<\/p>\n<li>\u670d\u52a1\u5668\u4e0a\u662f\u5426\u6709 Jupyter&#xff1a; \u5982\u679c\u4f60\u5728\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u4e86 Anaconda&#xff0c;\u901a\u5e38 base \u73af\u5883\u4f1a\u81ea\u5e26 Jupyter Notebook \u548c Jupyter Lab\u3002\u4f46\u662f&#xff0c;\u4f60\u7684\u6df1\u5ea6\u5b66\u4e60\u4ee3\u7801\u4f9d\u8d56\u4e8e pytorch_env \u73af\u5883\u4e2d\u7684\u5e93&#xff08;\u5982 PyTorch&#xff09;&#xff0c;\u6240\u4ee5\u4f60\u5fc5\u987b\u5728 pytorch_env \u73af\u5883\u4e2d\u8fd0\u884c\u4ee3\u7801\u3002<\/li>\n<li>\u5728 pytorch_env \u4e2d\u4f7f\u7528 Jupyter&#xff1a; \u5373\u4f7f base \u73af\u5883\u6709 Jupyter&#xff0c;pytorch_env \u4f5c\u4e3a\u4e00\u4e2a\u72ec\u7acb\u7684\u73af\u5883&#xff0c;\u9ed8\u8ba4\u662f\u6ca1\u6709\u7684\u3002\u4f60\u9700\u8981\u5728\u8fd9\u4e2a\u73af\u5883\u4e2d\u5b89\u88c5 ipykernel \u5e93&#xff0c;\u624d\u80fd\u8ba9 Jupyter&#xff08;\u6216 VS Code \u7684 Jupyter \u529f\u80fd&#xff09;\u5c06 pytorch_env \u8bc6\u522b\u4e3a\u4e00\u4e2a\u53ef\u7528\u7684\u5185\u6838\u3002<\/li>\n<p>\u5728 pytorch_env \u73af\u5883\u4e2d\u8bbe\u7f6e Jupyter \u5185\u6838\u7684\u6b65\u9aa4&#xff1a;<\/p>\n<ul>\n<li>\u6253\u5f00 VS Code \u96c6\u6210\u7ec8\u7aef&#xff0c;\u8fde\u63a5\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u3002<\/li>\n<li>\u6fc0\u6d3b\u73af\u5883&#xff1a;conda activate pytorch_env\n <\/li>\n<li>\u5b89\u88c5 ipykernel&#xff1a;pip <span class=\"token function\">install<\/span> ipykernel\n <\/li>\n<li>\u6ce8\u518c\u5185\u6838&#xff08;\u53ef\u9009\u4f46\u63a8\u8350&#xff09;&#xff1a;python -m ipykernel <span class=\"token function\">install<\/span> &#8211;user &#8211;name<span class=\"token operator\">&#061;<\/span>pytorch_env &#8211;display-name<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;PyTorch Env (pytorch_env)&#034;<\/span>\n <\/li>\n<\/ul>\n<p>\u5b8c\u6210\u8fd9\u4e9b\u6b65\u9aa4\u540e&#xff0c;pytorch_env \u5c31\u5177\u5907\u4e86\u4f5c\u4e3a Jupyter \u5185\u6838\u7684\u80fd\u529b\u3002<\/p>\n<h4>\u95ee\u9898\u4e09&#xff1a;\u5728 VS Code \u4e2d\u8fd0\u884c .ipynb \u6587\u4ef6\u65f6&#xff0c;\u5982\u4f55\u9009\u62e9\u6b63\u786e\u7684 pytorch_env \u5185\u6838&#xff1f;<\/h4>\n<p>\u89e3\u7b54&#xff1a;<\/p>\n<p>\u5728\u4f60\u8fde\u63a5\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u7684 VS Code \u4e2d\u6253\u5f00 .ipynb \u6587\u4ef6\u540e&#xff1a;<\/p>\n<li>VS Code \u4f1a\u5728 Notebook \u754c\u9762\u7684\u53f3\u4e0a\u89d2\u6216\u5e95\u90e8\u72b6\u6001\u680f\u663e\u793a\u5f53\u524d\u9009\u62e9\u7684 Python \u73af\u5883\/\u5185\u6838\u3002\u5982\u679c\u672a\u9009\u62e9&#xff0c;\u4f1a\u63d0\u793a\u4f60\u9009\u62e9\u3002<\/li>\n<li>\u70b9\u51fb\u663e\u793a\u5185\u6838\u540d\u79f0\u7684\u4f4d\u7f6e&#xff08;\u53ef\u80fd\u663e\u793a\u4e3a\u9ed8\u8ba4\u73af\u5883\u6216\u201c\u9009\u62e9\u5185\u6838\u201d&#xff09;\u3002\u5728\u6211\u7684\u73af\u5883\u4e2d&#xff0c;\u5b83\u53ef\u80fd\u663e\u793a\u4e3a \u6216 \u3002<\/li>\n<li>\u70b9\u51fb\u540e\u4f1a\u5f39\u51fa\u5185\u6838\u9009\u62e9\u83dc\u5355&#xff0c;\u770b\u5230\u7c7b\u4f3c\u8fd9\u6837\u7684\u9009\u9879&#xff1a;<\/li>\n<li>\u52a1\u5fc5\u9009\u62e9 \u201cPython \u73af\u5883\u2026\u201d\u3002<\/li>\n<li>\u5728\u5f39\u51fa\u7684\u5217\u8868\u4e2d&#xff0c;\u627e\u5230\u5e76\u9009\u62e9\u4f60\u7684\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\u7684 pytorch_env \u73af\u5883\u3002<\/li>\n<p>\u91cd\u8981&#xff1a; \u4e0d\u8981\u9009\u62e9\u201c\u73b0\u6709 Jupyter \u670d\u52a1\u5668\u2026\u201d&#xff0c;\u90a3\u4e2a\u9009\u9879\u662f\u8fde\u63a5\u4e00\u4e2a\u5df2\u7ecf\u72ec\u7acb\u8fd0\u884c\u8d77\u6765\u7684 Jupyter Server&#xff0c;\u800c\u4e0d\u662f\u5229\u7528 VS Code \u81ea\u52a8\u7ba1\u7406\u7684\u73af\u5883\u5185\u6838\u3002\u9009\u62e9\u201cPython \u73af\u5883\u2026\u201d\u8ba9 VS Code \u5229\u7528\u4f60\u7684 pytorch_env \u5728\u540e\u53f0\u542f\u52a8\u5185\u6838\u3002<\/p>\n<h4>\u95ee\u9898\u56db&#xff1a;\u6211\u7684 .py \u6587\u4ef6\u5982\u4f55\u8fd0\u884c&#xff1f;<\/h4>\n<p>\u89e3\u7b54&#xff1a;<\/p>\n<p>\u5bf9\u4e8e .py \u6587\u4ef6&#xff0c;\u540c\u6837\u9700\u8981\u786e\u4fdd\u4f7f\u7528 pytorch_env \u73af\u5883\u4e2d\u7684 Python \u89e3\u91ca\u5668\u6765\u6267\u884c\u3002<\/p>\n<li>\u5728 VS Code \u4e2d\u8bbe\u7f6e\u9879\u76ee\u7684 Python \u89e3\u91ca\u5668&#xff1a; \u5728 VS Code \u8fde\u63a5\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u7684\u72b6\u6001\u4e0b&#xff0c;\u6253\u5f00\u4f60\u7684 .py \u6587\u4ef6\u3002\u67e5\u770b VS Code \u5de6\u4e0b\u89d2\u7684\u72b6\u6001\u680f&#xff0c;\u5b83\u4f1a\u663e\u793a\u5f53\u524d\u9009\u62e9\u7684 Python \u89e3\u91ca\u5668\u3002\u70b9\u51fb\u5b83&#xff0c;\u9009\u62e9\u4f60\u7684\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\u7684 pytorch_env \u89e3\u91ca\u5668&#xff08;\u901a\u5e38\u663e\u793a\u4e3a Python X.x.x (&#039;pytorch_env&#039;: conda)&#xff09;\u3002<\/li>\n<li>\u8fd0\u884c .py \u6587\u4ef6&#xff1a; \u8bbe\u7f6e\u597d\u89e3\u91ca\u5668\u540e&#xff0c;\u6709\u51e0\u79cd\u8fd0\u884c\u65b9\u5f0f&#xff1a;\n<ul>\n<li>\u70b9\u51fb .py \u6587\u4ef6\u7f16\u8f91\u5668\u53f3\u4e0a\u89d2\u7684\u7eff\u8272\u201c\u8fd0\u884c\u201d\u6309\u94ae \u25b6\u3002<\/li>\n<li>\u53f3\u952e\u70b9\u51fb\u4ee3\u7801\u7f16\u8f91\u533a\u57df&#xff0c;\u9009\u62e9\u201c\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c Python \u6587\u4ef6\u201d\u3002<\/li>\n<li>\u6253\u5f00 VS Code \u96c6\u6210\u7ec8\u7aef&#xff08;\u901a\u5e38\u4f1a\u81ea\u52a8\u6fc0\u6d3b\u9009\u5b9a\u7684\u73af\u5883&#xff09;&#xff0c;\u624b\u52a8\u8f93\u5165 python your_script_name.py\u3002<\/li>\n<\/ul>\n<\/li>\n<h4>\u95ee\u9898\u4e94&#xff1a;\u8fd0\u884c\u4ee3\u7801\u65f6\u62a5\u9519 ModuleNotFoundError: No module named &#039;pandas&#039;&#xff1f;<\/h4>\n<p>\u89e3\u7b54&#xff1a;<\/p>\n<p>\u8fd9\u4e2a\u9519\u8bef\u8868\u660e\u4f60\u7684\u4ee3\u7801\u4f9d\u8d56\u7684 pandas \u5e93\u5728\u5f53\u524d\u6267\u884c\u4ee3\u7801\u7684 Python \u73af\u5883\u4e2d\u6ca1\u6709\u5b89\u88c5\u3002<\/p>\n<p>\u539f\u56e0&#xff1a; Anaconda base \u73af\u5883\u9ed8\u8ba4\u5305\u542b\u5f88\u591a\u5e93&#xff0c;\u4f46\u4f60\u65b0\u5efa\u7684 pytorch_env \u73af\u5883\u662f\u76f8\u5bf9\u5e72\u51c0\u7684&#xff0c;\u4e0d\u4f1a\u81ea\u52a8\u5305\u542b\u6240\u6709\u5e93&#xff0c;\u9664\u975e\u4f60\u5728\u521b\u5efa\u6216\u540e\u7eed\u5b89\u88c5\u65f6\u6307\u5b9a\u4e86\u3002\u5373\u4f7f base \u6709 pandas&#xff0c;pytorch_env \u4e5f\u53ef\u80fd\u6ca1\u6709\u3002<\/p>\n<p>\u89e3\u51b3&#xff1a; \u5728\u4f60\u7684 pytorch_env \u73af\u5883\u4e2d\u5b89\u88c5 pandas\u3002<\/p>\n<ul>\n<li>\u6253\u5f00 VS Code \u96c6\u6210\u7ec8\u7aef&#xff0c;\u8fde\u63a5\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u3002<\/li>\n<li>\u6fc0\u6d3b\u73af\u5883&#xff1a;conda activate pytorch_env<\/li>\n<li>\u5b89\u88c5 pandas&#xff1a;conda install pandas \u6216 pip install pandas<\/li>\n<li>\u5b89\u88c5\u5b8c\u6210\u540e&#xff0c;\u786e\u4fdd\u5728 pytorch_env \u4e2d\u518d\u6b21\u8fd0\u884c\u4ee3\u7801\u3002<\/li>\n<\/ul>\n<h4>\u95ee\u9898\u516d&#xff1a;\u5b89\u88c5 pandas \u540e&#xff0c;\u8fd0\u884c\u4ee3\u7801\u53c8\u62a5\u9519 AssertionError: dataset does not exist&#xff1f;<\/h4>\n<p>\u89e3\u7b54&#xff1a;<\/p>\n<p>\u8fd9\u4e2a\u9519\u8bef\u8868\u793a\u4f60\u7684\u4ee3\u7801\u5c1d\u8bd5\u6253\u5f00\u4e00\u4e2a\u6587\u4ef6&#xff0c;\u4f46\u6839\u636e\u63d0\u4f9b\u7684\u8def\u5f84\u627e\u4e0d\u5230\u8be5\u6587\u4ef6\u3002\u9519\u8bef\u53d1\u751f\u5728\u52a0\u8f7d\u6570\u636e\u96c6\u7684\u4ee3\u7801\u5904&#xff0c;\u8def\u5f84\u662f .\/pytorch-nn\/iris.txt\u3002<\/p>\n<p>\u539f\u56e0&#xff1a; .\/pytorch-nn\/iris.txt \u662f\u4e00\u4e2a\u76f8\u5bf9\u8def\u5f84&#xff0c;\u5b83\u7684\u5b9e\u9645\u4f4d\u7f6e\u53d6\u51b3\u4e8e\u7a0b\u5e8f\u8fd0\u884c\u65f6\u7684\u201c\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u201d\u3002\u4ea4\u4e92\u5f0f\u7a97\u53e3\u548c\u7ec8\u7aef\u8fd0\u884c\u65f6\u7684\u9ed8\u8ba4\u5de5\u4f5c\u76ee\u5f55\u53ef\u80fd\u4e0d\u540c&#xff0c;\u5bfc\u81f4\u76f8\u5bf9\u8def\u5f84\u89e3\u6790\u7ed3\u679c\u4e0d\u540c\u3002<\/p>\n<p>\u89e3\u51b3&#xff1a; \u4fee\u6539\u4ee3\u7801\u4e2d\u4f7f\u7528\u6587\u4ef6\u8def\u5f84\u7684\u5730\u65b9\u3002<\/p>\n<p>\u63a8\u8350\u4f7f\u7528\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84&#xff1a; \u627e\u5230 iris.txt \u5728\u670d\u52a1\u5668\u4e0a\u7684\u5b8c\u6574\u8def\u5f84&#xff08;\u4f8b\u5982 \/home\/user\/project\/data\/iris.txt&#xff09;&#xff0c;\u7136\u540e\u5728\u4ee3\u7801\u4e2d\u76f4\u63a5\u4f7f\u7528\u8fd9\u4e2a\u5b8c\u6574\u8def\u5f84\u3002\u8fd9\u6837\u65e0\u8bba\u4ece\u54ea\u91cc\u8fd0\u884c\u811a\u672c\u90fd\u80fd\u627e\u5230\u6587\u4ef6\u3002<\/p>\n<p>\u6216\u8005&#xff0c;\u5982\u679c\u7ee7\u7eed\u4f7f\u7528\u76f8\u5bf9\u8def\u5f84&#xff0c;\u9700\u8981\u786e\u4fdd\u8fd0\u884c\u65f6\u7684\u5de5\u4f5c\u76ee\u5f55\u662f\u6b63\u786e\u7684&#xff0c;\u5e76\u4e14\u4ee3\u7801\u4e2d\u7684\u76f8\u5bf9\u8def\u5f84\u662f\u76f8\u5bf9\u4e8e\u8fd9\u4e2a\u5de5\u4f5c\u76ee\u5f55\u7684\u3002\u4f46\u7edd\u5bf9\u8def\u5f84\u66f4\u4e0d\u5bb9\u6613\u51fa\u9519\u3002<\/p>\n<h4>\u95ee\u9898\u4e03&#xff1a;\u4fee\u590d\u6587\u4ef6\u8def\u5f84\u540e&#xff0c;\u8fd0\u884c\u4ee3\u7801\u53c8\u8fdb\u5165 TypeError: unsupported format string passed to Tensor.__format__ \u548c AttributeError: &#039;float&#039; object has no attribute &#039;item&#039; \u7684\u5faa\u73af\u62a5\u9519&#xff1f;<\/h4>\n<p>\u89e3\u7b54&#xff1a;<\/p>\n<p>\u8fd9\u4e24\u4e2a\u9519\u8bef\u90fd\u4e0e\u4f60\u5728\u6253\u5370\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u7684 Tensor \u53d8\u91cf\u6709\u5173&#xff08;\u4f8b\u5982 loss, accuracy&#xff09;\u3002<\/p>\n<ul>\n<li>TypeError: unsupported format string passed to Tensor.__format__&#xff1a; \u8fd9\u662f\u56e0\u4e3a\u4f60\u8bd5\u56fe\u7528 :.3f \u8fd9\u6837\u7684\u6807\u51c6\u5b57\u7b26\u4e32\u683c\u5f0f\u7b26\u76f4\u63a5\u683c\u5f0f\u5316\u4e00\u4e2a PyTorch \u7684 Tensor \u5bf9\u8c61\u3002Tensor \u4e0d\u652f\u6301\u8fd9\u79cd\u76f4\u63a5\u683c\u5f0f\u5316\u3002<\/li>\n<li>AttributeError: &#039;float&#039; object has no attribute &#039;item&#039;&#xff1a; \u8fd9\u662f\u56e0\u4e3a\u4f60\u5c1d\u8bd5\u5728\u4e00\u4e2a\u6807\u51c6\u7684 Python float \u6d6e\u70b9\u6570\u4e0a\u8c03\u7528 .item() \u65b9\u6cd5\u3002\u6807\u51c6\u7684 float \u6ca1\u6709 .item() \u65b9\u6cd5\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u4e24\u4e2a\u9519\u8bef\u6765\u56de\u51fa\u73b0&#xff0c;\u8bf4\u660e\u4f60\u7528\u4e8e\u6253\u5370\u7684\u53d8\u91cf&#xff08;\u5982 loss, train_acc, val_acc&#xff09;\u6709\u65f6\u662f Tensor&#xff0c;\u6709\u65f6\u5df2\u7ecf\u88ab\u8f6c\u6362\u4e3a float\u3002<\/p>\n<p>\u89e3\u51b3&#xff1a; \u5728\u6253\u5370\u8fd9\u4e9b\u53d8\u91cf\u65f6&#xff0c;\u4f7f\u7528 float() \u51fd\u6570\u6765\u83b7\u53d6\u5176\u6570\u503c\u3002float() \u65e2\u53ef\u4ee5\u5904\u7406\u5305\u542b\u5355\u4e2a\u6570\u503c\u7684 Tensor&#xff0c;\u4e5f\u53ef\u4ee5\u5904\u7406\u6807\u51c6\u7684 float\u3002<\/p>\n<p>\u5c06\u4f60\u7684\u6253\u5370\u8bed\u53e5&#xff08;\u901a\u5e38\u5728\u8bad\u7ec3\u5faa\u73af\u4e2d&#xff09;\u4fee\u6539\u4e3a\u7c7b\u4f3c\u8fd9\u6837&#xff1a;<\/p>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;train epoch{}\/{}\/ loss::{:.3f} train_acc::{:.3f} val_acc::{:.3f}&#034;<\/span><span class=\"token punctuation\">.<\/span><span class=\"token builtin\">format<\/span><span class=\"token punctuation\">(<\/span>epoch <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> epochs<span class=\"token punctuation\">,<\/span> <span class=\"token builtin\">float<\/span><span class=\"token punctuation\">(<\/span>loss<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token builtin\">float<\/span><span class=\"token punctuation\">(<\/span>train_acc<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token builtin\">float<\/span><span class=\"token punctuation\">(<\/span>val_acc<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>&#xff08;\u786e\u4fdd\u5bf9\u6240\u6709 Tensor \u6216\u53ef\u80fd\u662f Tensor \u7684\u53d8\u91cf\u4f7f\u7528 float()&#xff09;<\/p>\n<h4>\u95ee\u9898\u516b&#xff1a;\u4e3a\u4ec0\u4e48\u5728\u4ea4\u4e92\u5f0f\u7a97\u53e3\u8fd0\u884c\u6210\u529f\u4e86&#xff0c;\u4f46\u5728\u7ec8\u7aef\u4e0a\u8fd0\u884c .py \u6587\u4ef6\u53c8\u51fa\u73b0\u4e4b\u524d\u7684 AssertionError: dataset does not exist&#xff1f;<\/h4>\n<p>\u89e3\u7b54&#xff1a;<\/p>\n<p>\u8fd9\u4e2a\u95ee\u9898\u518d\u6b21\u6307\u5411\u4e86\u6587\u4ef6\u8def\u5f84\u548c\u8fd0\u884c\u65f6\u7684\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u7684\u533a\u522b\u3002\u867d\u7136\u4f60\u5728\u4ea4\u4e92\u5f0f\u7a97\u53e3\u6210\u529f\u8fd0\u884c&#xff0c;\u4f46\u5f53\u4f60\u5207\u6362\u5230\u7ec8\u7aef\u624b\u52a8\u8fd0\u884c .py \u6587\u4ef6\u65f6&#xff0c;\u7ec8\u7aef\u7684\u9ed8\u8ba4\u5de5\u4f5c\u76ee\u5f55\u5f88\u53ef\u80fd\u4e0e\u4ea4\u4e92\u5f0f\u7a97\u53e3\u7684\u4e0d\u540c\u3002<\/p>\n<ul>\n<li>\u4ea4\u4e92\u5f0f\u7a97\u53e3\/ .ipynb&#xff1a; \u5de5\u4f5c\u76ee\u5f55\u901a\u5e38\u9ed8\u8ba4\u662f\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\u3002<\/li>\n<li>\u7ec8\u7aef\u8fd0\u884c&#xff1a; \u5de5\u4f5c\u76ee\u5f55\u662f\u4f60\u6267\u884c python \u547d\u4ee4\u65f6\u6240\u5728\u7684\u76ee\u5f55\u3002<\/li>\n<\/ul>\n<p>\u5982\u679c\u4f60\u7684\u4ee3\u7801\u4f7f\u7528\u4e86\u76f8\u5bf9\u8def\u5f84&#xff08;\u4f8b\u5982 .\/data\/file.txt&#xff09;&#xff0c;\u8fd9\u4e2a\u76f8\u5bf9\u8def\u5f84\u4f1a\u6839\u636e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u6765\u89e3\u6790\u3002\u4e0d\u540c\u7684\u5de5\u4f5c\u76ee\u5f55\u4f1a\u5bfc\u81f4\u540c\u4e00\u4e2a\u76f8\u5bf9\u8def\u5f84\u89e3\u6790\u5230\u4e0d\u540c\u7684\u5b9e\u9645\u4f4d\u7f6e&#xff0c;\u5982\u679c\u6587\u4ef6\u4e0d\u5728\u90a3\u91cc\u5c31\u4f1a\u62a5\u9519\u3002<\/p>\n<p>\u89e3\u51b3&#xff1a; \u56de\u5230\u95ee\u9898\u516d\u7684\u89e3\u7b54&#xff0c;\u6700\u7a33\u59a5\u7684\u65b9\u5f0f\u662f\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u6570\u636e\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84&#xff0c;\u8fd9\u6837\u5c31\u4e0d\u4f1a\u53d7\u5230\u8fd0\u884c\u76ee\u5f55\u7684\u5f71\u54cd\u3002\u6216\u8005&#xff0c;\u786e\u4fdd\u4f60\u5728\u7ec8\u7aef\u8fd0\u884c\u811a\u672c\u65f6&#xff0c;\u5148 cd \u5230\u6b63\u786e\u7684\u76ee\u5f55&#xff08;\u901a\u5e38\u662f\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u6216\u8005\u6570\u636e\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55&#xff09;&#xff0c;\u518d\u6267\u884c python your_script.py\u3002<\/p>\n<h4>\u95ee\u9898\u4e5d&#xff1a;\u6211\u7ec8\u7aef\u6ca1\u6fc0\u6d3b\u865a\u62df\u73af\u5883&#xff0c;\u7ec8\u7aef\u63d0\u793a Python \u7248\u672c\u4e3a 2.7&#xff0c;\u90a3\u6211\u76f4\u63a5\u5728\u7ec8\u7aef\u8fd0\u884c Python \u6587\u4ef6&#xff0c;\u8c03\u7528\u7684\u662f\u54ea\u4e2a\u89e3\u91ca\u5668&#xff1f;<\/h4>\n<p>\u89e3\u7b54&#xff1a;<\/p>\n<p>\u5728\u7ec8\u7aef\u672a\u6fc0\u6d3b\u4efb\u4f55 Conda \u73af\u5883\u65f6&#xff0c;\u7ec8\u7aef\u63d0\u793a\u7b26\u663e\u793a Python 2.7.17 \u8868\u660e&#xff1a;\u5728\u4f60\u5f53\u524d\u7684 shell PATH \u73af\u5883\u53d8\u91cf\u4e0b&#xff0c;\u5f53\u4f60\u8f93\u5165 python \u547d\u4ee4\u65f6&#xff0c;shell \u7b2c\u4e00\u4e2a\u627e\u5230\u7684\u53ef\u6267\u884c\u6587\u4ef6\u662f\u5c5e\u4e8e Python 2.7.17 \u7248\u672c\u7684\u3002<\/p>\n<p>\u5728\u8fd9\u79cd\u72b6\u6001\u4e0b&#xff0c;\u5982\u679c\u4f60\u76f4\u63a5\u8f93\u5165 python your_script.py \u6765\u8fd0\u884c\u6587\u4ef6&#xff0c;\u8c03\u7528\u7684\u5c31\u662f\u90a3\u4e2a Python 2.7.17 \u89e3\u91ca\u5668\u3002 \u8fd9\u4f1a\u5bfc\u81f4\u4f9d\u8d56 Python 3 \u548c\u7279\u5b9a\u5e93\u7684\u4ee3\u7801\u51fa\u9519\u3002<\/p>\n<p>\u8981\u4f7f\u7528 pytorch_env \u73af\u5883\u4e2d\u7684\u89e3\u91ca\u5668&#xff0c;\u4f60\u9700\u8981&#xff1a;<\/p>\n<li>\u6fc0\u6d3b\u73af\u5883&#xff1a; conda activate pytorch_env \u7136\u540e python your_script.py\u3002<\/li>\n<li>\u76f4\u63a5\u6307\u5b9a\u89e3\u91ca\u5668\u8def\u5f84&#xff1a; \/newdata\/home\/liangweitang\/anaconda3\/envs\/pytorch_env\/bin\/python your_script_name.py (\u5982\u95ee\u9898\u5341\u6240\u8ff0)\u3002<\/li>\n<h4>\u95ee\u9898\u5341&#xff1a;\u4e3a\u4ec0\u4e48\u6211\u6ca1\u6fc0\u6d3b\u865a\u62df\u73af\u5883&#xff0c;\u4f46\u7ec8\u7aef\u663e\u793a\u81ea\u52a8\u6267\u884c\u4e86 \/full\/path\/to\/pytorch_env\/bin\/python &#8230; \u8fd9\u6837\u7684\u547d\u4ee4&#xff0c;\u5e76\u4e14\u6210\u529f\u8fd0\u884c\u4e86&#xff1f;<\/h4>\n<p>\u89e3\u7b54&#xff1a;<\/p>\n<p>\u8fd9\u6761\u5b8c\u6574\u7684\u547d\u4ee4 (\/newdata\/home\/liangweitang\/anaconda3\/envs\/pytorch_env\/bin\/python \/newdata\/home\/liangweitang\/python-test\/pytorch-nn\/nn.py) \u4e0d\u662f\u4f60\u81ea\u5df1\u624b\u52a8\u8f93\u5165\u7684&#xff0c;\u800c\u662f\u5f53\u4f60\u4ece VS Code \u754c\u9762&#xff08;\u4f8b\u5982\u70b9\u51fb .py \u6587\u4ef6\u53f3\u4e0a\u89d2\u7684\u8fd0\u884c\u6309\u94ae\u6216\u53f3\u952e\u83dc\u5355\u4e2d\u7684\u201c\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c Python \u6587\u4ef6\u201d&#xff09;\u8fd0\u884c\u811a\u672c\u65f6&#xff0c;VS Code \u81ea\u52a8\u4e3a\u4f60\u6784\u5efa\u5e76\u5728\u7ec8\u7aef\u4e2d\u6267\u884c\u7684\u547d\u4ee4\u3002<\/p>\n<p>\u539f\u56e0&#xff1a; \u8fd9\u662f VS Code Python \u6269\u5c55\u7684\u4e00\u4e2a\u4fbf\u6377\u529f\u80fd\u3002\u56e0\u4e3a\u4f60\u5728 VS Code \u4e2d\u5df2\u7ecf\u5c06\u9879\u76ee\u7684 Python \u89e3\u91ca\u5668\u8bbe\u7f6e\u4e3a\u4e86 pytorch_env&#xff0c;\u6240\u4ee5\u5f53\u4f60\u901a\u8fc7 VS Code \u7684\u8fd0\u884c\u529f\u80fd\u6267\u884c\u811a\u672c\u65f6&#xff0c;VS Code \u4f1a\u67e5\u627e\u8fd9\u4e2a\u8bbe\u7f6e&#xff0c;\u83b7\u53d6\u5230 pytorch_env \u89e3\u91ca\u5668\u7684\u5b8c\u6574\u8def\u5f84&#xff0c;\u7136\u540e\u6784\u5efa\u51fa\u5305\u542b\u89e3\u91ca\u5668\u5b8c\u6574\u8def\u5f84\u7684\u547d\u4ee4\u5e76\u53d1\u9001\u5230\u7ec8\u7aef\u6267\u884c\u3002<\/p>\n<p>\u6240\u4ee5&#xff0c;\u5373\u4f7f\u7ec8\u7aef\u672c\u8eab\u6ca1\u6709\u624b\u52a8\u6fc0\u6d3b\u73af\u5883&#xff0c;VS Code \u4e5f\u786e\u4fdd\u4e86\u811a\u672c\u662f\u4f7f\u7528\u4e86\u4f60\u6307\u5b9a\u7684 pytorch_env \u89e3\u91ca\u5668\u6765\u8fd0\u884c\u7684&#xff0c;\u4ece\u800c\u7ed5\u8fc7\u4e86\u7ec8\u7aef\u5f53\u524d\u7684 PATH \u8bbe\u7f6e\u3002<\/p>\n<h4>\u603b\u7ed3<\/h4>\n<p>\u901a\u8fc7 VS Code \u8fdc\u7a0b\u8fde\u63a5\u8fdb\u884c Python \u5f00\u53d1&#xff0c;\u6838\u5fc3\u5728\u4e8e\u6b63\u786e\u7ba1\u7406\u548c\u4f7f\u7528\u4e0d\u540c\u7684 Python \u73af\u5883&#xff08;\u5c24\u5176\u662f Conda \u73af\u5883&#xff09;\u3002\u7406\u89e3\u7ec8\u7aef\u6fc0\u6d3b\u3001VS Code \u89e3\u91ca\u5668\u9009\u62e9\u3001\u4ee5\u53ca\u4e0d\u540c\u8fd0\u884c\u6a21\u5f0f&#xff08;\u7ec8\u7aef .py\u3001\u4ea4\u4e92\u5f0f .py\u3001.ipynb&#xff09;\u7684\u5de5\u4f5c\u539f\u7406\u548c\u5b83\u4eec\u5bf9\u6587\u4ef6\u8def\u5f84\u3001\u5e93\u67e5\u627e\u7684\u5f71\u54cd&#xff0c;\u662f\u89e3\u51b3\u5927\u591a\u6570\u73af\u5883\u548c\u8fd0\u884c\u95ee\u9898\u7684\u5173\u952e\u3002\u638c\u63e1\u5728\u6b63\u786e\u73af\u5883\u4e2d\u5b89\u88c5\u5e93&#xff08;\u5982 ipykernel, pandas&#xff09;\u4ee5\u53ca\u5904\u7406\u597d\u6587\u4ef6\u8def\u5f84\u95ee\u9898&#xff0c;\u5c31\u80fd\u66f4\u987a\u7545\u5730\u8fdb\u884c\u8fdc\u7a0b\u5f00\u53d1\u3002<\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb737\u6b21\uff0c\u70b9\u8d5e6\u6b21\uff0c\u6536\u85cf7\u6b21\u3002\u901a\u8fc7 VS Code \u8fdc\u7a0b\u8fde\u63a5\u8fdb\u884c Python \u5f00\u53d1\uff0c\u6838\u5fc3\u5728\u4e8e\u6b63\u786e\u7ba1\u7406\u548c\u4f7f\u7528\u4e0d\u540c\u7684 Python \u73af\u5883\uff08\u5c24\u5176\u662f Conda \u73af\u5883\uff09\u3002\u7406\u89e3\u7ec8\u7aef\u6fc0\u6d3b\u3001VS Code \u89e3\u91ca\u5668\u9009\u62e9\u3001\u4ee5\u53ca\u4e0d\u540c\u8fd0\u884c\u6a21\u5f0f\uff08\u7ec8\u7aef.py\u3001\u4ea4\u4e92\u5f0f.py.ipynb\uff09\u7684\u5de5\u4f5c\u539f\u7406\u548c\u5b83\u4eec\u5bf9\u6587\u4ef6\u8def\u5f84\u3001\u5e93\u67e5\u627e\u7684\u5f71\u54cd\uff0c\u662f\u89e3\u51b3\u5927\u591a\u6570\u73af\u5883\u548c\u8fd0\u884c\u95ee\u9898\u7684\u5173\u952e\u3002\u638c\u63e1\u5728\u6b63\u786e\u73af\u5883\u4e2d\u5b89\u88c5\u5e93\uff08\u5982ipykernelpandas\uff09\u4ee5\u53ca\u5904\u7406\u597d\u6587\u4ef6\u8def\u5f84\u95ee\u9898\uff0c\u5c31\u80fd\u66f4\u987a\u7545\u5730\u8fdb\u884c\u8fdc\u7a0b\u5f00\u53d1\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[76,43,86],"topic":[],"class_list":["post-32198","post","type-post","status-publish","format-standard","hentry","category-server","tag-vscode","tag-43","tag-86"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>VSCode\u8fde\u63a5\u670d\u52a1\u5668\u8dd1\u6df1\u5ea6\u5b66\u4e60\u4ee3\u7801\u76f8\u5173\u95ee\u9898\uff08\u78140\u5927\u6a21\u578b\u5b66\u4e60\u7b2c\u516b\u5929\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/32198.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"VSCode\u8fde\u63a5\u670d\u52a1\u5668\u8dd1\u6df1\u5ea6\u5b66\u4e60\u4ee3\u7801\u76f8\u5173\u95ee\u9898\uff08\u78140\u5927\u6a21\u578b\u5b66\u4e60\u7b2c\u516b\u5929\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb737\u6b21\uff0c\u70b9\u8d5e6\u6b21\uff0c\u6536\u85cf7\u6b21\u3002\u901a\u8fc7 VS Code \u8fdc\u7a0b\u8fde\u63a5\u8fdb\u884c Python \u5f00\u53d1\uff0c\u6838\u5fc3\u5728\u4e8e\u6b63\u786e\u7ba1\u7406\u548c\u4f7f\u7528\u4e0d\u540c\u7684 Python \u73af\u5883\uff08\u5c24\u5176\u662f Conda \u73af\u5883\uff09\u3002\u7406\u89e3\u7ec8\u7aef\u6fc0\u6d3b\u3001VS Code \u89e3\u91ca\u5668\u9009\u62e9\u3001\u4ee5\u53ca\u4e0d\u540c\u8fd0\u884c\u6a21\u5f0f\uff08\u7ec8\u7aef.py\u3001\u4ea4\u4e92\u5f0f.py.ipynb\uff09\u7684\u5de5\u4f5c\u539f\u7406\u548c\u5b83\u4eec\u5bf9\u6587\u4ef6\u8def\u5f84\u3001\u5e93\u67e5\u627e\u7684\u5f71\u54cd\uff0c\u662f\u89e3\u51b3\u5927\u591a\u6570\u73af\u5883\u548c\u8fd0\u884c\u95ee\u9898\u7684\u5173\u952e\u3002\u638c\u63e1\u5728\u6b63\u786e\u73af\u5883\u4e2d\u5b89\u88c5\u5e93\uff08\u5982ipykernelpandas\uff09\u4ee5\u53ca\u5904\u7406\u597d\u6587\u4ef6\u8def\u5f84\u95ee\u9898\uff0c\u5c31\u80fd\u66f4\u987a\u7545\u5730\u8fdb\u884c\u8fdc\u7a0b\u5f00\u53d1\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/32198.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-23T01:01:03+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/32198.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/32198.html\",\"name\":\"VSCode\u8fde\u63a5\u670d\u52a1\u5668\u8dd1\u6df1\u5ea6\u5b66\u4e60\u4ee3\u7801\u76f8\u5173\u95ee\u9898\uff08\u78140\u5927\u6a21\u578b\u5b66\u4e60\u7b2c\u516b\u5929\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-23T01:01:03+00:00\",\"dateModified\":\"2025-04-23T01:01:03+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/32198.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/32198.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/32198.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"VSCode\u8fde\u63a5\u670d\u52a1\u5668\u8dd1\u6df1\u5ea6\u5b66\u4e60\u4ee3\u7801\u76f8\u5173\u95ee\u9898\uff08\u78140\u5927\u6a21\u578b\u5b66\u4e60\u7b2c\u516b\u5929\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"VSCode\u8fde\u63a5\u670d\u52a1\u5668\u8dd1\u6df1\u5ea6\u5b66\u4e60\u4ee3\u7801\u76f8\u5173\u95ee\u9898\uff08\u78140\u5927\u6a21\u578b\u5b66\u4e60\u7b2c\u516b\u5929\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/32198.html","og_locale":"zh_CN","og_type":"article","og_title":"VSCode\u8fde\u63a5\u670d\u52a1\u5668\u8dd1\u6df1\u5ea6\u5b66\u4e60\u4ee3\u7801\u76f8\u5173\u95ee\u9898\uff08\u78140\u5927\u6a21\u578b\u5b66\u4e60\u7b2c\u516b\u5929\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb737\u6b21\uff0c\u70b9\u8d5e6\u6b21\uff0c\u6536\u85cf7\u6b21\u3002\u901a\u8fc7 VS Code \u8fdc\u7a0b\u8fde\u63a5\u8fdb\u884c Python \u5f00\u53d1\uff0c\u6838\u5fc3\u5728\u4e8e\u6b63\u786e\u7ba1\u7406\u548c\u4f7f\u7528\u4e0d\u540c\u7684 Python \u73af\u5883\uff08\u5c24\u5176\u662f Conda \u73af\u5883\uff09\u3002\u7406\u89e3\u7ec8\u7aef\u6fc0\u6d3b\u3001VS Code \u89e3\u91ca\u5668\u9009\u62e9\u3001\u4ee5\u53ca\u4e0d\u540c\u8fd0\u884c\u6a21\u5f0f\uff08\u7ec8\u7aef.py\u3001\u4ea4\u4e92\u5f0f.py.ipynb\uff09\u7684\u5de5\u4f5c\u539f\u7406\u548c\u5b83\u4eec\u5bf9\u6587\u4ef6\u8def\u5f84\u3001\u5e93\u67e5\u627e\u7684\u5f71\u54cd\uff0c\u662f\u89e3\u51b3\u5927\u591a\u6570\u73af\u5883\u548c\u8fd0\u884c\u95ee\u9898\u7684\u5173\u952e\u3002\u638c\u63e1\u5728\u6b63\u786e\u73af\u5883\u4e2d\u5b89\u88c5\u5e93\uff08\u5982ipykernelpandas\uff09\u4ee5\u53ca\u5904\u7406\u597d\u6587\u4ef6\u8def\u5f84\u95ee\u9898\uff0c\u5c31\u80fd\u66f4\u987a\u7545\u5730\u8fdb\u884c\u8fdc\u7a0b\u5f00\u53d1\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/32198.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-23T01:01:03+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/32198.html","url":"https:\/\/www.wsisp.com\/helps\/32198.html","name":"VSCode\u8fde\u63a5\u670d\u52a1\u5668\u8dd1\u6df1\u5ea6\u5b66\u4e60\u4ee3\u7801\u76f8\u5173\u95ee\u9898\uff08\u78140\u5927\u6a21\u578b\u5b66\u4e60\u7b2c\u516b\u5929\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-23T01:01:03+00:00","dateModified":"2025-04-23T01:01:03+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/32198.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/32198.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/32198.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"VSCode\u8fde\u63a5\u670d\u52a1\u5668\u8dd1\u6df1\u5ea6\u5b66\u4e60\u4ee3\u7801\u76f8\u5173\u95ee\u9898\uff08\u78140\u5927\u6a21\u578b\u5b66\u4e60\u7b2c\u516b\u5929\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/32198","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=32198"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/32198\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=32198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=32198"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=32198"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=32198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}