{"id":963349,"date":"2024-12-27T04:17:10","date_gmt":"2024-12-26T20:17:10","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/963349.html"},"modified":"2024-12-27T04:17:12","modified_gmt":"2024-12-26T20:17:12","slug":"vscode%e5%a6%82%e4%bd%95%e6%90%ad%e5%bb%bapython%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/963349.html","title":{"rendered":"vscode\u5982\u4f55\u642d\u5efapython\u73af\u5883"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24180659\/8f03dfab-602c-43f6-ac14-4e03722aec90.webp\" alt=\"vscode\u5982\u4f55\u642d\u5efapython\u73af\u5883\" \/><\/p>\n<p><p> \u8981\u5728Visual Studio Code\uff08VSCode\uff09\u4e2d\u642d\u5efaPython\u73af\u5883\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\u5b9e\u73b0\uff1a<strong>\u5b89\u88c5Python\u3001\u5b89\u88c5VSCode\u3001\u5b89\u88c5Python\u6269\u5c55\u3001\u914d\u7f6ePython\u89e3\u91ca\u5668\u3001\u521b\u5efa\u5e76\u8fd0\u884cPython\u6587\u4ef6<\/strong>\u3002\u5176\u4e2d\uff0c\u914d\u7f6ePython\u89e3\u91ca\u5668\u662f\u5173\u952e\u6b65\u9aa4\uff0c\u786e\u4fdd\u9009\u62e9\u6b63\u786e\u7684Python\u7248\u672c\u4ee5\u9002\u5e94\u9879\u76ee\u9700\u6c42\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u6bcf\u4e2a\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u5b89\u88c5Python<\/p>\n<\/p>\n<p><p>\u5728VSCode\u4e2d\u642d\u5efaPython\u73af\u5883\u7684\u7b2c\u4e00\u6b65\u662f\u5b89\u88c5Python\u672c\u8eab\u3002Python\u662f\u4e00\u79cd\u5e7f\u6cdb\u4f7f\u7528\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u62e5\u6709\u5f3a\u5927\u7684\u5e93\u548c\u793e\u533a\u652f\u6301\u3002<\/p>\n<\/p>\n<p><p>1.1\u3001\u4e0b\u8f7dPython<\/p>\n<\/p>\n<p><p>\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%E4%BB%A5%E4%B8%8B%E8%BD%BD%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC%E7%9A%84Python%E3%80%82%E6%A0%B9%E6%8D%AE%E4%BD%A0%E7%9A%84%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E9%80%89%E6%8B%A9%E5%90%88%E9%80%82%E7%9A%84%E7%89%88%E6%9C%AC%EF%BC%8C%E5%B9%B6%E4%B8%8B%E8%BD%BD%E5%AE%89%E8%A3%85%E5%8C%85%E3%80%82\">https:\/\/www.python.org\/\uff09\u4ee5\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684Python\u3002\u6839\u636e\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u9009\u62e9\u5408\u9002\u7684\u7248\u672c\uff0c\u5e76\u4e0b\u8f7d\u5b89\u88c5\u5305\u3002<\/a><\/p>\n<\/p>\n<p><p>1.2\u3001\u5b89\u88c5Python<\/p>\n<\/p>\n<p><p>\u8fd0\u884c\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\uff0c\u6309\u7167\u5b89\u88c5\u5411\u5bfc\u8fdb\u884c\u5b89\u88c5\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u786e\u4fdd\u9009\u62e9\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u5c06\u81ea\u52a8\u5c06Python\u6dfb\u52a0\u5230\u7cfb\u7edf\u8def\u5f84\u4e2d\uff0c\u4f7f\u5176\u80fd\u591f\u5728\u547d\u4ee4\u884c\u4e2d\u88ab\u8bc6\u522b\u3002<\/p>\n<\/p>\n<p><p>1.3\u3001\u9a8c\u8bc1\u5b89\u88c5<\/p>\n<\/p>\n<p><p>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08Windows\uff09\u6216\u7ec8\u7aef\uff08macOS\/Linux\uff09\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u9a8c\u8bc1Python\u5b89\u88c5\u662f\u5426\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u5b89\u88c5\u6210\u529f\uff0c\u5c06\u663e\u793aPython\u7684\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u5b89\u88c5VSCode<\/p>\n<\/p>\n<p><p>VSCode\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u5f00\u6e90\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6269\u5c55\u548c\u529f\u80fd\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\u3002<\/p>\n<\/p>\n<p><p>2.1\u3001\u4e0b\u8f7dVSCode<\/p>\n<\/p>\n<p><p>\u8bbf\u95eeVisual Studio Code\u7684\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/code.visualstudio.com\/%EF%BC%89%E4%BB%A5%E4%B8%8B%E8%BD%BD%E9%80%82%E5%90%88%E4%BD%A0%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%9A%84%E5%AE%89%E8%A3%85%E5%8C%85%E3%80%82\">https:\/\/code.visualstudio.com\/\uff09\u4ee5\u4e0b\u8f7d\u9002\u5408\u4f60\u64cd\u4f5c\u7cfb\u7edf\u7684\u5b89\u88c5\u5305\u3002<\/a><\/p>\n<\/p>\n<p><p>2.2\u3001\u5b89\u88c5VSCode<\/p>\n<\/p>\n<p><p>\u8fd0\u884c\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\uff0c\u6309\u7167\u5b89\u88c5\u5411\u5bfc\u8fdb\u884c\u5b89\u88c5\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u542f\u52a8VSCode\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u5b89\u88c5Python\u6269\u5c55<\/p>\n<\/p>\n<p><p>\u8981\u5728VSCode\u4e2d\u9ad8\u6548\u5730\u5f00\u53d1Python\u5e94\u7528\u7a0b\u5e8f\uff0cPython\u6269\u5c55\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u3002<\/p>\n<\/p>\n<p><p>3.1\u3001\u6253\u5f00\u6269\u5c55\u5e02\u573a<\/p>\n<\/p>\n<p><p>\u542f\u52a8VSCode\u540e\uff0c\u70b9\u51fb\u5de6\u4fa7\u6d3b\u52a8\u680f\u4e2d\u7684\u201c\u6269\u5c55\u201d\u56fe\u6807\uff0c\u6216\u6309\u4e0b\u5feb\u6377\u952e<code>Ctrl+Shift+X<\/code>\uff08Windows\uff09\u6216<code>Cmd+Shift+X<\/code>\uff08macOS\uff09\u6253\u5f00\u6269\u5c55\u5e02\u573a\u3002<\/p>\n<\/p>\n<p><p>3.2\u3001\u641c\u7d22Python\u6269\u5c55<\/p>\n<\/p>\n<p><p>\u5728\u6269\u5c55\u5e02\u573a\u7684\u641c\u7d22\u680f\u4e2d\u8f93\u5165\u201cPython\u201d\uff0c\u627e\u5230\u7531Microsoft\u63d0\u4f9b\u7684Python\u6269\u5c55\uff0c\u5e76\u70b9\u51fb\u201c\u5b89\u88c5\u201d\u6309\u94ae\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><p>3.3\u3001\u914d\u7f6ePython\u6269\u5c55<\/p>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0cPython\u6269\u5c55\u5c06\u81ea\u52a8\u914d\u7f6e\uff0c\u5e76\u4e3a\u4f60\u63d0\u4f9bPython\u76f8\u5173\u7684\u529f\u80fd\uff0c\u5982\u4ee3\u7801\u8865\u5168\u3001\u4ee3\u7801\u68c0\u67e5\u548c\u8c03\u8bd5\u652f\u6301\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u914d\u7f6ePython\u89e3\u91ca\u5668<\/p>\n<\/p>\n<p><p>\u914d\u7f6ePython\u89e3\u91ca\u5668\u662fVSCode\u4e2d\u642d\u5efaPython\u73af\u5883\u7684\u5173\u952e\u6b65\u9aa4\u3002\u6b63\u786e\u7684\u914d\u7f6e\u53ef\u4ee5\u786e\u4fddVSCode\u4f7f\u7528\u6b63\u786e\u7684Python\u7248\u672c\u6765\u8fd0\u884c\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><p>4.1\u3001\u6253\u5f00\u547d\u4ee4\u9762\u677f<\/p>\n<\/p>\n<p><p>\u5728VSCode\u4e2d\uff0c\u6309\u4e0b\u5feb\u6377\u952e<code>Ctrl+Shift+P<\/code>\uff08Windows\uff09\u6216<code>Cmd+Shift+P<\/code>\uff08macOS\uff09\u6253\u5f00\u547d\u4ee4\u9762\u677f\u3002<\/p>\n<\/p>\n<p><p>4.2\u3001\u9009\u62e9Python\u89e3\u91ca\u5668<\/p>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u9762\u677f\u4e2d\u8f93\u5165\u201cPython: Select Interpreter\u201d\uff0c\u7136\u540e\u9009\u62e9\u4f60\u5e0c\u671b\u4f7f\u7528\u7684Python\u89e3\u91ca\u5668\u3002\u5982\u679c\u4f60\u5b89\u88c5\u4e86\u591a\u4e2aPython\u7248\u672c\uff0c\u786e\u4fdd\u9009\u62e9\u6b63\u786e\u7684\u7248\u672c\u3002<\/p>\n<\/p>\n<p><p>4.3\u3001\u914d\u7f6e\u5de5\u4f5c\u533a<\/p>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u6b63\u5728\u4e3a\u7279\u5b9a\u9879\u76ee\u914d\u7f6ePython\u73af\u5883\uff0c\u53ef\u4ee5\u9009\u62e9\u5c06Python\u89e3\u91ca\u5668\u914d\u7f6e\u4e3a\u5de5\u4f5c\u533a\u7279\u5b9a\u7684\u8bbe\u7f6e\u3002\u8fd9\u53ef\u4ee5\u901a\u8fc7\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u6216\u7f16\u8f91<code>.vscode\/settings.json<\/code>\u6587\u4ef6\u6765\u5b9e\u73b0\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001\u521b\u5efa\u5e76\u8fd0\u884cPython\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u73b0\u5728\uff0c\u4f60\u5df2\u7ecf\u6210\u529f\u5728VSCode\u4e2d\u914d\u7f6e\u4e86Python\u73af\u5883\uff0c\u63a5\u4e0b\u6765\u53ef\u4ee5\u521b\u5efa\u5e76\u8fd0\u884cPython\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><p>5.1\u3001\u521b\u5efaPython\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u5728VSCode\u4e2d\uff0c\u70b9\u51fb\u5de6\u4fa7\u6d3b\u52a8\u680f\u4e2d\u7684\u201c<a href=\"https:\/\/docs.pingcode.com\/blog\/project-management\/58557.html\" target=\"_blank\">\u8d44\u6e90\u7ba1\u7406<\/a>\u5668\u201d\u56fe\u6807\uff0c\u7136\u540e\u70b9\u51fb\u201c\u65b0\u5efa\u6587\u4ef6\u201d\u6309\u94ae\uff0c\u8f93\u5165\u6587\u4ef6\u540d\u4ee5<code>.py<\/code>\u4f5c\u4e3a\u6269\u5c55\u540d\uff08\u4f8b\u5982\uff0c<code>hello.py<\/code>\uff09\u3002<\/p>\n<\/p>\n<p><p>5.2\u3001\u7f16\u5199Python\u4ee3\u7801<\/p>\n<\/p>\n<p><p>\u5728\u65b0\u521b\u5efa\u7684Python\u6587\u4ef6\u4e2d\uff0c\u8f93\u5165\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello, VSCode!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>5.3\u3001\u8fd0\u884cPython\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u4fdd\u5b58\u6587\u4ef6\u540e\uff0c\u53f3\u952e\u70b9\u51fb\u7f16\u8f91\u5668\u4e2d\u7684\u4ee3\u7801\u533a\u57df\uff0c\u9009\u62e9\u201c\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884cPython\u6587\u4ef6\u201d\u9009\u9879\uff0c\u6216\u8005\u4f7f\u7528\u5feb\u6377\u952e<code>Ctrl+Alt+N<\/code>\uff08Windows\uff09\u6216<code>Cmd+Option+N<\/code>\uff08macOS\uff09\u6765\u8fd0\u884c\u4ee3\u7801\u3002\u4f60\u5c06\u5728VSCode\u7684\u7ec8\u7aef\u4e2d\u770b\u5230\u8f93\u51fa\u7ed3\u679c\u3002<\/p>\n<\/p>\n<p><p>\u516d\u3001\u5b89\u88c5\u548c\u7ba1\u7406Python\u5305<\/p>\n<\/p>\n<p><p>\u5728Python\u5f00\u53d1\u4e2d\uff0c\u5b89\u88c5\u548c\u7ba1\u7406\u7b2c\u4e09\u65b9\u5e93\u548c\u5305\u662f\u5e38\u89c1\u7684\u9700\u6c42\u3002VSCode\u4e2d\u53ef\u4ee5\u4f7f\u7528Python\u7684\u5305\u7ba1\u7406\u5de5\u5177<code>pip<\/code>\u6765\u5b9e\u73b0\u8fd9\u4e00\u70b9\u3002<\/p>\n<\/p>\n<p><p>6.1\u3001\u5b89\u88c5pip<\/p>\n<\/p>\n<p><p>\u5728\u5927\u591a\u6570Python\u5b89\u88c5\u4e2d\uff0c<code>pip<\/code>\u5df2\u7ecf\u4f5c\u4e3a\u6807\u51c6\u5de5\u5177\u63d0\u4f9b\u3002\u5982\u679c\u6ca1\u6709\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python -m ensurepip<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>6.2\u3001\u5b89\u88c5Python\u5305<\/p>\n<\/p>\n<p><p>\u5728VSCode\u7684\u7ec8\u7aef\u4e2d\uff0c\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u6765\u5b89\u88c5\u6240\u9700\u7684Python\u5305\u3002\u4f8b\u5982\uff0c\u5b89\u88c5<code>requests<\/code>\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>6.3\u3001\u7ba1\u7406Python\u5305<\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u901a\u8fc7<code>pip list<\/code>\u547d\u4ee4\u67e5\u770b\u5df2\u5b89\u88c5\u7684Python\u5305\uff0c\u901a\u8fc7<code>pip uninstall \u5305\u540d<\/code>\u547d\u4ee4\u5378\u8f7d\u4e0d\u9700\u8981\u7684\u5305\u3002<\/p>\n<\/p>\n<p><p>\u4e03\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883<\/p>\n<\/p>\n<p><p>\u5728Python\u9879\u76ee\u4e2d\u4f7f\u7528\u865a\u62df\u73af\u5883\u662f\u4e00\u4e2a\u63a8\u8350\u7684\u6700\u4f73\u5b9e\u8df5\uff0c\u5b83\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u9879\u76ee\u63d0\u4f9b\u72ec\u7acb\u7684\u5305\u7ba1\u7406\u548c\u73af\u5883\u914d\u7f6e\u3002<\/p>\n<\/p>\n<p><p>7.1\u3001\u521b\u5efa\u865a\u62df\u73af\u5883<\/p>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e2d\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python -m venv venv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>venv<\/code>\u7684\u865a\u62df\u73af\u5883\u76ee\u5f55\u3002<\/p>\n<\/p>\n<p><p>7.2\u3001\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/p>\n<\/p>\n<p><p>\u5728Windows\u4e2d\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">.\\venv\\Scripts\\activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728macOS\/Linux\u4e2d\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">source venv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6fc0\u6d3b\u540e\uff0c\u7ec8\u7aef\u63d0\u793a\u7b26\u524d\u4f1a\u663e\u793a\u865a\u62df\u73af\u5883\u540d\u79f0\u3002<\/p>\n<\/p>\n<p><p>7.3\u3001\u5728\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5\u5305<\/p>\n<\/p>\n<p><p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5728\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5\u6240\u9700\u7684Python\u5305\uff0c\u786e\u4fdd\u9879\u76ee\u7684\u4f9d\u8d56\u5173\u7cfb\u3002<\/p>\n<\/p>\n<p><p>\u516b\u3001\u8c03\u8bd5Python\u4ee3\u7801<\/p>\n<\/p>\n<p><p>VSCode\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u8c03\u8bd5\u529f\u80fd\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u8f7b\u677e\u5730\u8c03\u8bd5Python\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><p>8.1\u3001\u8bbe\u7f6e\u65ad\u70b9<\/p>\n<\/p>\n<p><p>\u5728Python\u4ee3\u7801\u7684\u884c\u53f7\u65c1\u8fb9\u70b9\u51fb\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u65ad\u70b9\u3002\u8fd0\u884c\u4ee3\u7801\u65f6\uff0c\u7a0b\u5e8f\u5c06\u5728\u65ad\u70b9\u5904\u6682\u505c\u3002<\/p>\n<\/p>\n<p><p>8.2\u3001\u542f\u52a8\u8c03\u8bd5<\/p>\n<\/p>\n<p><p>\u70b9\u51fb\u5de6\u4fa7\u6d3b\u52a8\u680f\u4e2d\u7684\u201c\u8fd0\u884c\u548c\u8c03\u8bd5\u201d\u56fe\u6807\uff0c\u6216\u8005\u6309\u4e0b\u5feb\u6377\u952e<code>F5<\/code>\u542f\u52a8\u8c03\u8bd5\u3002VSCode\u5c06\u5f00\u59cb\u5728\u65ad\u70b9\u5904\u6682\u505c\uff0c\u5e76\u5141\u8bb8\u4f60\u9010\u6b65\u6267\u884c\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><p>8.3\u3001\u68c0\u67e5\u53d8\u91cf<\/p>\n<\/p>\n<p><p>\u5728\u8c03\u8bd5\u6a21\u5f0f\u4e0b\uff0cVSCode\u5c06\u663e\u793a\u5f53\u524d\u4f5c\u7528\u57df\u4e2d\u7684\u53d8\u91cf\u503c\uff0c\u5e2e\u52a9\u4f60\u5206\u6790\u4ee3\u7801\u7684\u6267\u884c\u72b6\u6001\u3002<\/p>\n<\/p>\n<p><p>\u516b\u3001\u4f7f\u7528Jupyter\u7b14\u8bb0\u672c<\/p>\n<\/p>\n<p><p>VSCode\u652f\u6301Jupyter\u7b14\u8bb0\u672c\uff0c\u53ef\u4ee5\u5728\u4ea4\u4e92\u5f0f\u73af\u5883\u4e2d\u6267\u884cPython\u4ee3\u7801\uff0c\u975e\u5e38\u9002\u5408\u6570\u636e\u5206\u6790\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u3002<\/p>\n<\/p>\n<p><p>9.1\u3001\u5b89\u88c5Jupyter\u6269\u5c55<\/p>\n<\/p>\n<p><p>\u5728VSCode\u7684\u6269\u5c55\u5e02\u573a\u4e2d\u641c\u7d22\u5e76\u5b89\u88c5Jupyter\u6269\u5c55\u3002<\/p>\n<\/p>\n<p><p>9.2\u3001\u521b\u5efaJupyter\u7b14\u8bb0\u672c<\/p>\n<\/p>\n<p><p>\u5728VSCode\u4e2d\uff0c\u70b9\u51fb\u201c\u65b0\u5efa\u6587\u4ef6\u201d\u6309\u94ae\uff0c\u8f93\u5165\u6587\u4ef6\u540d\u4ee5<code>.ipynb<\/code>\u4f5c\u4e3a\u6269\u5c55\u540d\uff08\u4f8b\u5982\uff0c<code>notebook.ipynb<\/code>\uff09\u3002<\/p>\n<\/p>\n<p><p>9.3\u3001\u7f16\u5199\u548c\u8fd0\u884cJupyter\u4ee3\u7801\u5355\u5143<\/p>\n<\/p>\n<p><p>\u5728Jupyter\u7b14\u8bb0\u672c\u4e2d\uff0c\u53ef\u4ee5\u521b\u5efa\u4ee3\u7801\u5355\u5143\uff0c\u5e76\u8f93\u5165Python\u4ee3\u7801\u3002\u70b9\u51fb\u201c\u8fd0\u884c\u201d\u6309\u94ae\u4ee5\u6267\u884c\u4ee3\u7801\u5355\u5143\uff0c\u5e76\u5728\u8f93\u51fa\u533a\u57df\u67e5\u770b\u7ed3\u679c\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u5728VSCode\u4e2d\u6210\u529f\u642d\u5efaPython\u73af\u5883\u3002\u8fd9\u4e2a\u73af\u5883\u5c06\u4e3a\u4f60\u63d0\u4f9b\u9ad8\u6548\u7684\u5f00\u53d1\u4f53\u9a8c\uff0c\u5305\u62ec\u4ee3\u7801\u7f16\u8f91\u3001\u8c03\u8bd5\u3001\u5305\u7ba1\u7406\u548c\u4ea4\u4e92\u5f0f\u8ba1\u7b97\u3002\u65e0\u8bba\u662f\u521d\u5b66\u8005\u8fd8\u662f\u7ecf\u9a8c\u4e30\u5bcc\u7684\u5f00\u53d1\u8005\uff0cVSCode\u90fd\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u4e14\u7075\u6d3b\u7684\u5de5\u5177\uff0c\u80fd\u591f\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u8fdb\u884cPython\u7f16\u7a0b\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728VSCode\u4e2d\u5b89\u88c5Python\u6269\u5c55\uff1f<\/strong><br \/>\u5728Visual Studio Code\u4e2d\uff0c\u5b89\u88c5Python\u6269\u5c55\u975e\u5e38\u7b80\u5355\u3002\u6253\u5f00VSCode\u540e\uff0c\u524d\u5f80\u5de6\u4fa7\u6d3b\u52a8\u680f\u7684\u6269\u5c55\u89c6\u56fe\uff0c\u641c\u7d22\u201cPython\u201d\u3002\u627e\u5230\u7531Microsoft\u53d1\u5e03\u7684\u5b98\u65b9\u6269\u5c55\u5e76\u70b9\u51fb\u201c\u5b89\u88c5\u201d\u6309\u94ae\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0cVSCode\u4f1a\u81ea\u52a8\u4e3a\u60a8\u63d0\u4f9bPython\u76f8\u5173\u7684\u529f\u80fd\uff0c\u5982\u4ee3\u7801\u8865\u5168\u3001\u8c03\u8bd5\u652f\u6301\u548cLinting\u7b49\u3002<\/p>\n<p><strong>\u5728VSCode\u4e2d\u5982\u4f55\u8bbe\u7f6ePython\u89e3\u91ca\u5668\uff1f<\/strong><br \/>\u8bbe\u7f6ePython\u89e3\u91ca\u5668\u53ef\u4ee5\u786e\u4fdd\u60a8\u7684\u9879\u76ee\u4f7f\u7528\u6b63\u786e\u7684Python\u7248\u672c\u3002\u5728VSCode\u5e95\u90e8\u72b6\u6001\u680f\uff0c\u60a8\u4f1a\u770b\u5230\u5f53\u524d\u9009\u62e9\u7684Python\u89e3\u91ca\u5668\u3002\u70b9\u51fb\u8be5\u90e8\u5206\uff0c\u60a8\u5c06\u770b\u5230\u7cfb\u7edf\u4e2d\u5df2\u5b89\u88c5\u7684\u6240\u6709Python\u7248\u672c\u7684\u5217\u8868\u3002\u9009\u62e9\u60a8\u60f3\u8981\u4f7f\u7528\u7684\u7248\u672c\u3002\u5982\u679c\u60a8\u7684\u9879\u76ee\u4e2d\u6709\u865a\u62df\u73af\u5883\uff0c\u786e\u4fdd\u9009\u62e9\u5bf9\u5e94\u7684\u865a\u62df\u73af\u5883\u89e3\u91ca\u5668\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728VSCode\u4e2d\u521b\u5efa\u548c\u7ba1\u7406Python\u865a\u62df\u73af\u5883\uff1f<\/strong><br \/>\u5728VSCode\u4e2d\u521b\u5efa\u865a\u62df\u73af\u5883\u53ef\u4ee5\u5e2e\u52a9\u60a8\u7ba1\u7406\u9879\u76ee\u4f9d\u8d56\u3002\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u8f93\u5165\u547d\u4ee4<code>python -m venv env<\/code>\u6765\u521b\u5efa\u540d\u4e3a\u201cenv\u201d\u7684\u865a\u62df\u73af\u5883\u3002\u521b\u5efa\u5b8c\u6210\u540e\uff0c\u60a8\u9700\u8981\u6fc0\u6d3b\u8be5\u73af\u5883\u3002\u5728Windows\u4e0a\u4f7f\u7528<code>env\\Scripts\\activate<\/code>\uff0c\u5728macOS\u6216Linux\u4e0a\u4f7f\u7528<code>source env\/bin\/activate<\/code>\u3002\u6fc0\u6d3b\u540e\uff0c\u60a8\u53ef\u4ee5\u5728\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5\u6240\u9700\u7684\u5e93\u548c\u4f9d\u8d56\uff0c\u786e\u4fdd\u9879\u76ee\u7684\u72ec\u7acb\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u5728Visual Studio Code\uff08VSCode\uff09\u4e2d\u642d\u5efaPython\u73af\u5883\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\u5b9e\u73b0\uff1a\u5b89\u88c5 [&hellip;]","protected":false},"author":3,"featured_media":963357,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/963349"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=963349"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/963349\/revisions"}],"predecessor-version":[{"id":963359,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/963349\/revisions\/963359"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/963357"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=963349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=963349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=963349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}