{"id":980431,"date":"2024-12-27T06:54:24","date_gmt":"2024-12-26T22:54:24","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/980431.html"},"modified":"2024-12-27T06:54:26","modified_gmt":"2024-12-26T22:54:26","slug":"vs%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85python%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/980431.html","title":{"rendered":"vs\u5982\u4f55\u5b89\u88c5python\u73af\u5883"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24205822\/18db3cab-26d0-4821-b171-7fa915488b5b.webp\" alt=\"vs\u5982\u4f55\u5b89\u88c5python\u73af\u5883\" \/><\/p>\n<p><p> <strong>\u5728Visual Studio\u4e2d\u5b89\u88c5Python\u73af\u5883\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u4e0b\u8f7d\u548c\u5b89\u88c5Python\u3001\u5b89\u88c5VS\u7684Python\u6269\u5c55\u3001\u914d\u7f6ePython\u89e3\u91ca\u5668\u3001\u521b\u5efa\u548c\u7ba1\u7406\u865a\u62df\u73af\u5883\u3001\u8c03\u8bd5Python\u4ee3\u7801\u3002<\/strong>\u5176\u4e2d\uff0c\u6700\u91cd\u8981\u7684\u4e00\u6b65\u662f\u5b89\u88c5VS\u7684Python\u6269\u5c55\uff0c\u56e0\u4e3a\u5b83\u63d0\u4f9b\u4e86\u5bf9Python\u9879\u76ee\u7684\u5168\u9762\u652f\u6301\uff0c\u5305\u62ec\u667a\u80fd\u611f\u77e5\u3001\u4ee3\u7801\u5206\u6790\u548c\u8c03\u8bd5\u529f\u80fd\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u6bcf\u4e2a\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4e0b\u8f7d\u548c\u5b89\u88c5Python<\/p>\n<\/p>\n<p><p>\u5728\u5f00\u59cb\u4f7f\u7528Visual Studio\u8fdb\u884cPython\u5f00\u53d1\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u5728\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5Python\u89e3\u91ca\u5668\u3002\u8fd9\u662f\u56e0\u4e3aPython\u73af\u5883\u63d0\u4f9b\u4e86\u8fd0\u884cPython\u4ee3\u7801\u6240\u9700\u7684\u57fa\u672c\u5de5\u5177\u548c\u5e93\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9<\/strong>\uff1a\u9996\u5148\uff0c\u524d\u5f80Python\u7684\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%E4%B8%8B%E8%BD%BD%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC%E7%9A%84Python%E5%AE%89%E8%A3%85%E7%A8%8B%E5%BA%8F%E3%80%82%E5%BB%BA%E8%AE%AE%E4%B8%8B%E8%BD%BD%E7%A8%B3%E5%AE%9A%E7%89%88%E6%9C%AC%E4%BB%A5%E7%A1%AE%E4%BF%9D%E5%85%BC%E5%AE%B9%E6%80%A7%E3%80%82\">https:\/\/www.python.org\/\uff09\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684Python\u5b89\u88c5\u7a0b\u5e8f\u3002\u5efa\u8bae\u4e0b\u8f7d\u7a33\u5b9a\u7248\u672c\u4ee5\u786e\u4fdd\u517c\u5bb9\u6027\u3002<\/a><\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f<\/strong>\uff1a\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u786e\u4fdd\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u76f4\u63a5\u4f7f\u7528Python\u547d\u4ee4\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong>\uff1a\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\uff0c\u8f93\u5165<code>python --version<\/code>\u6765\u9a8c\u8bc1Python\u662f\u5426\u5b89\u88c5\u6210\u529f\u3002\u5982\u679c\u5b89\u88c5\u6210\u529f\uff0c\u4f1a\u663e\u793aPython\u7684\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u5b89\u88c5VS\u7684Python\u6269\u5c55<\/p>\n<\/p>\n<p><p>Visual Studio\u63d0\u4f9b\u4e86\u4e00\u7cfb\u5217\u6269\u5c55\u6765\u652f\u6301\u4e0d\u540c\u7684\u7f16\u7a0b\u8bed\u8a00\u548c\u6846\u67b6\u3002\u4e3a\u4e86\u5f00\u53d1Python\u9879\u76ee\uff0c\u60a8\u9700\u8981\u5b89\u88c5Python\u6269\u5c55\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00Visual Studio<\/strong>\uff1a\u542f\u52a8Visual Studio\uff0c\u5e76\u6253\u5f00\u201c\u6269\u5c55\u201d\u83dc\u5355\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u641c\u7d22Python\u6269\u5c55<\/strong>\uff1a\u5728\u6269\u5c55\u5e02\u573a\u4e2d\u641c\u7d22\u201cPython\u201d\uff0c\u627e\u5230\u201cPython support for Visual Studio\u201d\u6269\u5c55\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5\u6269\u5c55<\/strong>\uff1a\u70b9\u51fb\u201c\u5b89\u88c5\u201d\u6309\u94ae\uff0c\u6309\u7167\u63d0\u793a\u5b8c\u6210Python\u6269\u5c55\u7684\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u91cd\u542fVisual Studio<\/strong>\uff1a\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u91cd\u542fVisual Studio\u4ee5\u786e\u4fdd\u6269\u5c55\u6b63\u5e38\u52a0\u8f7d\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u914d\u7f6ePython\u89e3\u91ca\u5668<\/p>\n<\/p>\n<p><p>Python\u89e3\u91ca\u5668\u662f\u8fd0\u884cPython\u4ee3\u7801\u7684\u6838\u5fc3\u7ec4\u4ef6\u3002\u5728Visual Studio\u4e2d\uff0c\u60a8\u9700\u8981\u6307\u5b9aPython\u89e3\u91ca\u5668\u7684\u4f4d\u7f6e\uff0c\u4ee5\u4fbf\u6b63\u786e\u8fd0\u884c\u548c\u8c03\u8bd5Python\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00Python\u9879\u76ee<\/strong>\uff1a\u5728Visual Studio\u4e2d\u521b\u5efa\u6216\u6253\u5f00\u4e00\u4e2aPython\u9879\u76ee\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8bbf\u95ee\u9879\u76ee\u8bbe\u7f6e<\/strong>\uff1a\u53f3\u952e\u70b9\u51fb\u9879\u76ee\u540d\u79f0\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u6216\u201c\u9879\u76ee\u8bbe\u7f6e\u201d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9009\u62e9Python\u89e3\u91ca\u5668<\/strong>\uff1a\u5728\u8bbe\u7f6e\u754c\u9762\u4e2d\uff0c\u5bfc\u822a\u5230\u201cPython Environments\u201d\u9009\u9879\u5361\uff0c\u70b9\u51fb\u201cAdd Environment\u201d\u6309\u94ae\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6e\u89e3\u91ca\u5668\u8def\u5f84<\/strong>\uff1a\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\uff0c\u6307\u5b9aPython\u89e3\u91ca\u5668\u7684\u8def\u5f84\uff08\u901a\u5e38\u662f\u5b89\u88c5\u76ee\u5f55\u4e2d\u7684python.exe\u6587\u4ef6\uff09\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u521b\u5efa\u548c\u7ba1\u7406\u865a\u62df\u73af\u5883<\/p>\n<\/p>\n<p><p>\u865a\u62df\u73af\u5883\u662f\u9694\u79bb\u7684Python\u73af\u5883\uff0c\u5141\u8bb8\u60a8\u5728\u9879\u76ee\u4e2d\u4f7f\u7528\u4e0d\u540c\u7684Python\u7248\u672c\u548c\u5e93\u3002\u4f7f\u7528\u865a\u62df\u73af\u5883\u53ef\u4ee5\u907f\u514d\u5e93\u7248\u672c\u51b2\u7a81\uff0c\u5e76\u7b80\u5316\u9879\u76ee\u7684\u4f9d\u8d56\u7ba1\u7406\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u865a\u62df\u73af\u5883<\/strong>\uff1a\u5728Visual Studio\u4e2d\uff0c\u53f3\u952e\u70b9\u51fb\u9879\u76ee\u540d\u79f0\uff0c\u9009\u62e9\u201cPython\u201d\u83dc\u5355\u4e2d\u7684\u201cCreate Virtual Environment\u201d\u9009\u9879\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9009\u62e9Python\u7248\u672c<\/strong>\uff1a\u5728\u521b\u5efa\u865a\u62df\u73af\u5883\u65f6\uff0c\u53ef\u4ee5\u9009\u62e9\u5177\u4f53\u7684Python\u7248\u672c\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u7cfb\u7edf\u5c06\u4f7f\u7528\u9ed8\u8ba4\u7684Python\u7248\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/strong>\uff1a\u865a\u62df\u73af\u5883\u521b\u5efa\u5b8c\u6210\u540e\uff0c\u9700\u8981\u6fc0\u6d3b\u5b83\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0cVisual Studio\u4f1a\u81ea\u52a8\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5\u9879\u76ee\u4f9d\u8d56<\/strong>\uff1a\u5728\u865a\u62df\u73af\u5883\u4e2d\uff0c\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5\u9879\u76ee\u6240\u9700\u7684\u5e93\u3002\u4f8b\u5982\uff0c\u8fd0\u884c<code>pip install requests<\/code>\u6765\u5b89\u88c5requests\u5e93\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u8c03\u8bd5Python\u4ee3\u7801<\/p>\n<\/p>\n<p><p>\u8c03\u8bd5\u662f\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u7684\u91cd\u8981\u73af\u8282\u3002Visual Studio\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u8c03\u8bd5\u5de5\u5177\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u5b9a\u4f4d\u548c\u89e3\u51b3\u4ee3\u7801\u4e2d\u7684\u95ee\u9898\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u8bbe\u7f6e\u65ad\u70b9<\/strong>\uff1a\u5728\u4ee3\u7801\u7f16\u8f91\u5668\u4e2d\uff0c\u70b9\u51fb\u884c\u53f7\u65c1\u7684\u7a7a\u767d\u5904\u8bbe\u7f6e\u65ad\u70b9\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u542f\u52a8\u8c03\u8bd5<\/strong>\uff1a\u70b9\u51fb\u201c\u8c03\u8bd5\u201d\u83dc\u5355\u4e2d\u7684\u201c\u542f\u52a8\u8c03\u8bd5\u201d\u6309\u94ae\uff0c\u6216\u8005\u6309F5\u952e\u542f\u52a8\u8c03\u8bd5\u5668\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u67e5\u770b\u53d8\u91cf\u548c\u8868\u8fbe\u5f0f<\/strong>\uff1a\u5728\u8c03\u8bd5\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u4ee5\u67e5\u770b\u53d8\u91cf\u7684\u5f53\u524d\u503c\uff0c\u5e76\u8bc4\u4f30\u8868\u8fbe\u5f0f\u7684\u7ed3\u679c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6b65\u8fdb\u8c03\u8bd5<\/strong>\uff1a\u4f7f\u7528\u8c03\u8bd5\u5de5\u5177\u680f\u4e0a\u7684\u201c\u6b65\u5165\u201d\u3001\u201c\u6b65\u8fc7\u201d\u548c\u201c\u6b65\u51fa\u201d\u6309\u94ae\uff0c\u9010\u6b65\u6267\u884c\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u5728Visual Studio\u4e2d\u6210\u529f\u5b89\u88c5\u548c\u914d\u7f6ePython\u73af\u5883\uff0c\u5e76\u5f00\u59cb\u9ad8\u6548\u7684Python\u5f00\u53d1\u5de5\u4f5c\u3002\u786e\u4fdd\u5b9a\u671f\u66f4\u65b0Python\u89e3\u91ca\u5668\u548cVS\u6269\u5c55\uff0c\u4ee5\u83b7\u5f97\u6700\u65b0\u7684\u529f\u80fd\u548c\u4fee\u590d\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728VS\u4e2d\u5b89\u88c5Python\u73af\u5883\uff1f<\/strong><br \/>\u5728Visual Studio\u4e2d\u5b89\u88c5Python\u73af\u5883\u76f8\u5bf9\u7b80\u5355\u3002\u9996\u5148\uff0c\u786e\u4fdd\u60a8\u5df2\u7ecf\u5b89\u88c5\u4e86Visual Studio\u7684\u6700\u65b0\u7248\u672c\u3002\u63a5\u7740\uff0c\u6253\u5f00Visual Studio Installer\uff0c\u9009\u62e9\u201c\u4fee\u6539\u201d\u5df2\u5b89\u88c5\u7684Visual Studio\u7248\u672c\u3002\u5728\u5de5\u4f5c\u8d1f\u8f7d\u9009\u9879\u4e2d\uff0c\u52fe\u9009\u201cPython\u5f00\u53d1\u201d\u9009\u9879\uff0c\u786e\u4fdd\u5b89\u88c5Python\u5de5\u5177\u548c\u76f8\u5173\u7ec4\u4ef6\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u5c31\u53ef\u4ee5\u521b\u5efaPython\u9879\u76ee\u5e76\u5f00\u59cb\u7f16\u7801\u4e86\u3002<\/p>\n<p><strong>Visual Studio\u652f\u6301\u54ea\u4e9b\u7248\u672c\u7684Python\uff1f<\/strong><br \/>Visual Studio\u652f\u6301\u591a\u4e2aPython\u7248\u672c\uff0c\u5305\u62ecPython 3.6\u53ca\u4ee5\u4e0a\u7248\u672c\u3002\u60a8\u53ef\u4ee5\u5728\u5b89\u88c5Python\u65f6\u9009\u62e9\u9002\u5408\u60a8\u9700\u6c42\u7684\u7248\u672c\u3002\u5982\u679c\u60a8\u5df2\u7ecf\u6709Python\u5b89\u88c5\u5728\u7cfb\u7edf\u4e2d\uff0cVisual Studio\u4f1a\u81ea\u52a8\u68c0\u6d4b\u5e76\u4f7f\u7528\u8be5\u7248\u672c\u3002\u4e3a\u4e86\u786e\u4fdd\u4e0e\u9879\u76ee\u7684\u517c\u5bb9\u6027\uff0c\u5efa\u8bae\u4f7f\u7528\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728VS\u4e2d\u7ba1\u7406Python\u5305\uff1f<\/strong><br \/>\u5728Visual Studio\u4e2d\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u5185\u7f6e\u7684\u5305\u7ba1\u7406\u5668\u6765\u7ba1\u7406Python\u5305\u3002\u6253\u5f00\u9879\u76ee\u540e\uff0c\u53f3\u952e\u70b9\u51fb\u89e3\u51b3\u65b9\u6848<a href=\"https:\/\/docs.pingcode.com\/blog\/project-management\/58557.html\" target=\"_blank\">\u8d44\u6e90\u7ba1\u7406<\/a>\u5668\u4e2d\u7684\u201cPython\u73af\u5883\u201d\uff0c\u9009\u62e9\u201c\u7ba1\u7406\u5305\u201d\u9009\u9879\u3002\u5728\u8fd9\u91cc\uff0c\u60a8\u53ef\u4ee5\u641c\u7d22\u3001\u5b89\u88c5\u3001\u66f4\u65b0\u6216\u5378\u8f7d\u6240\u9700\u7684Python\u5305\u3002\u4f7f\u7528\u8fd9\u4e2a\u529f\u80fd\u53ef\u4ee5\u5e2e\u52a9\u60a8\u8f7b\u677e\u7ba1\u7406\u9879\u76ee\u6240\u9700\u7684\u4f9d\u8d56\u9879\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Visual Studio\u4e2d\u5b89\u88c5Python\u73af\u5883\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u4e0b\u8f7d\u548c\u5b89\u88c5Python\u3001\u5b89\u88c5VS\u7684Python\u6269 [&hellip;]","protected":false},"author":3,"featured_media":980439,"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\/980431"}],"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=980431"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/980431\/revisions"}],"predecessor-version":[{"id":980440,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/980431\/revisions\/980440"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/980439"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=980431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=980431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=980431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}