{"id":1063591,"date":"2024-12-31T16:01:50","date_gmt":"2024-12-31T08:01:50","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1063591.html"},"modified":"2024-12-31T16:01:53","modified_gmt":"2024-12-31T08:01:53","slug":"%e5%a6%82%e4%bd%95%e5%b0%86python%e4%b8%8b%e8%bd%bd%e5%88%b0d%e7%9b%98","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1063591.html","title":{"rendered":"\u5982\u4f55\u5c06python\u4e0b\u8f7d\u5230d\u76d8"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/12\/edebc7f6-fbc9-4135-9464-4b87b1d8935d.webp?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"\u5982\u4f55\u5c06python\u4e0b\u8f7d\u5230d\u76d8\" \/><\/p>\n<p><p> <strong>\u5c06Python\u4e0b\u8f7d\u5230D\u76d8\u7684\u6b65\u9aa4<\/strong>\uff1a\u4e0b\u8f7dPython\u5b89\u88c5\u5305\u3001\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3001\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5\u3001\u6307\u5b9aD\u76d8\u4f5c\u4e3a\u5b89\u88c5\u76ee\u5f55\u3001\u5b8c\u6210\u5b89\u88c5\u3002<strong>\u5177\u4f53\u64cd\u4f5c\u65b9\u6cd5\u5982\u4e0b\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4e0b\u8f7dPython\u5b89\u88c5\u5305<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u6d4f\u89c8\u5668\u5e76\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff1a<a href=\"https:\/\/www.python.org\/\">https:\/\/www.python.org\/<\/a><\/li>\n<li>\u5728\u4e3b\u9875\u4e0a\uff0c\u70b9\u51fb\u201cDownloads\u201d\u9009\u9879\u5361\uff0c\u5e76\u9009\u62e9\u9002\u5408\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684Python\u7248\u672c\uff08\u4f8b\u5982\uff0cWindows\uff09\u3002<\/li>\n<li>\u70b9\u51fb\u4e0b\u8f7d\u94fe\u63a5\uff0c\u4fdd\u5b58Python\u5b89\u88c5\u5305\u5230\u60a8\u7684\u8ba1\u7b97\u673a\u4e0a\u3002<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f<\/p>\n<\/p>\n<ol>\n<li>\u627e\u5230\u521a\u521a\u4e0b\u8f7d\u7684Python\u5b89\u88c5\u5305\uff08\u901a\u5e38\u5728\u201c\u4e0b\u8f7d\u201d\u6587\u4ef6\u5939\u4e2d\uff09\u3002<\/li>\n<li>\u53cc\u51fb\u5b89\u88c5\u5305\u4ee5\u542f\u52a8\u5b89\u88c5\u7a0b\u5e8f\u3002<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5<\/p>\n<\/p>\n<ol>\n<li>\u5728\u5b89\u88c5\u7a0b\u5e8f\u542f\u52a8\u540e\uff0c\u60a8\u4f1a\u770b\u5230\u4e00\u4e2a\u6b22\u8fce\u754c\u9762\u3002\u5728\u8fd9\u4e2a\u754c\u9762\u4e0a\uff0c\u8bf7\u786e\u4fdd\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u5168\u5c40\u4f7f\u7528Python\u3002<\/li>\n<li>\u70b9\u51fb\u201cCustomize installation\u201d\u6309\u94ae\uff0c\u8fdb\u5165\u81ea\u5b9a\u4e49\u5b89\u88c5\u754c\u9762\u3002<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u6307\u5b9aD\u76d8\u4f5c\u4e3a\u5b89\u88c5\u76ee\u5f55<\/p>\n<\/p>\n<ol>\n<li>\u5728\u81ea\u5b9a\u4e49\u5b89\u88c5\u754c\u9762\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u8981\u5b89\u88c5\u7684\u7ec4\u4ef6\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u9ed8\u8ba4\u9009\u9879\u5df2\u7ecf\u8db3\u591f\u4f7f\u7528\u3002\u70b9\u51fb\u201cNext\u201d\u7ee7\u7eed\u3002<\/li>\n<li>\u5728\u201cAdvanced Options\u201d\u754c\u9762\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u5b89\u88c5\u8def\u5f84\u3002\u5728\u201cCustomize install location\u201d\u5b57\u6bb5\u4e2d\uff0c\u8f93\u5165\u60a8\u5e0c\u671b\u5b89\u88c5Python\u7684\u76ee\u5f55\uff0c\u4f8b\u5982\u201cD:\\Python\u201d\u3002<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u5b8c\u6210\u5b89\u88c5<\/p>\n<\/p>\n<ol>\n<li>\u70b9\u51fb\u201cInstall\u201d\u6309\u94ae\uff0c\u5f00\u59cb\u5b89\u88c5Python\u3002\u5b89\u88c5\u7a0b\u5e8f\u4f1a\u5c06Python\u5b89\u88c5\u5230\u60a8\u6307\u5b9a\u7684D\u76d8\u76ee\u5f55\u3002<\/li>\n<li>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002\u4f8b\u5982\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u5e76\u8f93\u5165\u201cpython &#8211;version\u201d\uff0c\u5982\u679c\u663e\u793a\u4e86Python\u7684\u7248\u672c\u4fe1\u606f\uff0c\u5219\u8868\u793a\u5b89\u88c5\u6210\u529f\u3002<\/li>\n<\/ol>\n<p><p><strong>\u5b89\u88c5Python\u7684\u8be6\u7ec6\u6b65\u9aa4<\/strong><\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4e0b\u8f7dPython\u5b89\u88c5\u5305<\/p>\n<\/p>\n<p><p>\u4e0b\u8f7dPython\u5b89\u88c5\u5305\u662f\u5b89\u88c5Python\u7684\u7b2c\u4e00\u6b65\u3002Python\u5b98\u65b9\u7f51\u7ad9\u63d0\u4f9b\u4e86\u9002\u7528\u4e8e\u5404\u79cd\u64cd\u4f5c\u7cfb\u7edf\u7684\u5b89\u88c5\u5305\uff0c\u5305\u62ecWindows\u3001macOS\u548cLinux\u3002\u5728\u4e0b\u8f7d\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u786e\u5b9a\u60a8\u7684\u64cd\u4f5c\u7cfb\u7edf\u7c7b\u578b\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u4e0b\u8f7d\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u6d4f\u89c8\u5668\u5e76\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff1a<a href=\"https:\/\/www.python.org\/\">https:\/\/www.python.org\/<\/a><\/li>\n<li>\u5728\u4e3b\u9875\u4e0a\uff0c\u70b9\u51fb\u201cDownloads\u201d\u9009\u9879\u5361\u3002\u6839\u636e\u60a8\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0c\u9009\u62e9\u76f8\u5e94\u7684Python\u7248\u672c\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fWindows\u64cd\u4f5c\u7cfb\u7edf\uff0c\u8bf7\u9009\u62e9\u201cDownload Python for Windows\u201d\u3002<\/li>\n<li>\u70b9\u51fb\u4e0b\u8f7d\u94fe\u63a5\uff0c\u4fdd\u5b58Python\u5b89\u88c5\u5305\u5230\u60a8\u7684\u8ba1\u7b97\u673a\u4e0a\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u5b89\u88c5\u5305\u4f1a\u81ea\u52a8\u4fdd\u5b58\u5230\u201c\u4e0b\u8f7d\u201d\u6587\u4ef6\u5939\u4e2d\u3002<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f<\/p>\n<\/p>\n<p><p>\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u60a8\u9700\u8981\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u64cd\u4f5c\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u6587\u4ef6<a href=\"https:\/\/docs.pingcode.com\/blog\/project-management\/58557.html\" target=\"_blank\">\u8d44\u6e90\u7ba1\u7406<\/a>\u5668\uff0c\u627e\u5230\u521a\u521a\u4e0b\u8f7d\u7684Python\u5b89\u88c5\u5305\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b89\u88c5\u5305\u4f1a\u4fdd\u5b58\u5728\u201c\u4e0b\u8f7d\u201d\u6587\u4ef6\u5939\u4e2d\u3002<\/li>\n<li>\u53cc\u51fb\u5b89\u88c5\u5305\u4ee5\u542f\u52a8\u5b89\u88c5\u7a0b\u5e8f\u3002\u5b89\u88c5\u7a0b\u5e8f\u4f1a\u663e\u793a\u4e00\u4e2a\u6b22\u8fce\u754c\u9762\uff0c\u63d0\u793a\u60a8\u5f00\u59cb\u5b89\u88c5Python\u3002<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5<\/p>\n<\/p>\n<p><p>\u5728\u6b22\u8fce\u754c\u9762\u4e0a\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u9ed8\u8ba4\u5b89\u88c5\u6216\u81ea\u5b9a\u4e49\u5b89\u88c5\u3002\u4e3a\u4e86\u5c06Python\u5b89\u88c5\u5230D\u76d8\uff0c\u60a8\u9700\u8981\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u64cd\u4f5c\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5728\u6b22\u8fce\u754c\u9762\u4e0a\uff0c\u786e\u4fdd\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\u3002\u8fd9\u5c06\u4f7fPython\u5b89\u88c5\u7a0b\u5e8f\u5c06Python\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u5168\u5c40\u4f7f\u7528Python\u3002<\/li>\n<li>\u70b9\u51fb\u201cCustomize installation\u201d\u6309\u94ae\uff0c\u8fdb\u5165\u81ea\u5b9a\u4e49\u5b89\u88c5\u754c\u9762\u3002\u5728\u8fd9\u4e2a\u754c\u9762\u4e0a\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u8981\u5b89\u88c5\u7684\u7ec4\u4ef6\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u9ed8\u8ba4\u9009\u9879\u5df2\u7ecf\u8db3\u591f\u4f7f\u7528\u3002\u5982\u679c\u60a8\u9700\u8981\u989d\u5916\u7684\u7ec4\u4ef6\uff0c\u53ef\u4ee5\u52fe\u9009\u76f8\u5e94\u7684\u9009\u9879\u3002<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u6307\u5b9aD\u76d8\u4f5c\u4e3a\u5b89\u88c5\u76ee\u5f55<\/p>\n<\/p>\n<p><p>\u5728\u81ea\u5b9a\u4e49\u5b89\u88c5\u754c\u9762\uff0c\u60a8\u9700\u8981\u6307\u5b9aPython\u7684\u5b89\u88c5\u8def\u5f84\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u64cd\u4f5c\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5728\u201cCustomize install location\u201d\u5b57\u6bb5\u4e2d\uff0c\u8f93\u5165\u60a8\u5e0c\u671b\u5b89\u88c5Python\u7684\u76ee\u5f55\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u8f93\u5165\u201cD:\\Python\u201d\u4f5c\u4e3a\u5b89\u88c5\u8def\u5f84\u3002<\/li>\n<li>\u70b9\u51fb\u201cNext\u201d\u6309\u94ae\uff0c\u8fdb\u5165\u201cAdvanced Options\u201d\u754c\u9762\u3002\u5728\u8fd9\u4e2a\u754c\u9762\u4e0a\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u66f4\u591a\u7684\u5b89\u88c5\u9009\u9879\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u9ed8\u8ba4\u9009\u9879\u5df2\u7ecf\u8db3\u591f\u4f7f\u7528\u3002\u5982\u679c\u60a8\u9700\u8981\u989d\u5916\u7684\u9009\u9879\uff0c\u53ef\u4ee5\u52fe\u9009\u76f8\u5e94\u7684\u9009\u9879\u3002<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u5b8c\u6210\u5b89\u88c5<\/p>\n<\/p>\n<p><p>\u5728\u5b8c\u6210\u4ee5\u4e0a\u6b65\u9aa4\u540e\uff0c\u60a8\u53ef\u4ee5\u5f00\u59cb\u5b89\u88c5Python\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u64cd\u4f5c\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u70b9\u51fb\u201cInstall\u201d\u6309\u94ae\uff0c\u5f00\u59cb\u5b89\u88c5Python\u3002\u5b89\u88c5\u7a0b\u5e8f\u4f1a\u5c06Python\u5b89\u88c5\u5230\u60a8\u6307\u5b9a\u7684D\u76d8\u76ee\u5f55\u3002\u5b89\u88c5\u8fc7\u7a0b\u53ef\u80fd\u9700\u8981\u51e0\u5206\u949f\u65f6\u95f4\uff0c\u8bf7\u8010\u5fc3\u7b49\u5f85\u3002<\/li>\n<li>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002\u4f8b\u5982\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u5e76\u8f93\u5165\u201cpython &#8211;version\u201d\uff0c\u5982\u679c\u663e\u793a\u4e86Python\u7684\u7248\u672c\u4fe1\u606f\uff0c\u5219\u8868\u793a\u5b89\u88c5\u6210\u529f\u3002<\/li>\n<\/ol>\n<p><p><strong>\u9a8c\u8bc1Python\u5b89\u88c5\u662f\u5426\u6210\u529f<\/strong><\/p>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u9a8c\u8bc1Python\u662f\u5426\u6210\u529f\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u3002\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u60a8\u53ef\u4ee5\u6309\u4e0b\u201cWin + R\u201d\u952e\uff0c\u8f93\u5165\u201ccmd\u201d\u5e76\u6309\u4e0b\u56de\u8f66\u952e\u4ee5\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002\u5728macOS\u548cLinux\u7cfb\u7edf\u4e2d\uff0c\u60a8\u53ef\u4ee5\u6253\u5f00\u7ec8\u7aef\u3002<\/li>\n<li>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u4e2d\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5e76\u6309\u4e0b\u56de\u8f66\u952e\uff1a<\/li>\n<\/ol>\n<p><pre><code>python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u663e\u793a\u4e86Python\u7684\u7248\u672c\u4fe1\u606f\uff08\u4f8b\u5982\u201cPython 3.9.7\u201d\uff09\uff0c\u5219\u8868\u793aPython\u5df2\u6210\u529f\u5b89\u88c5\u5e76\u6b63\u786e\u914d\u7f6e\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/p>\n<\/p>\n<p><p><strong>\u5b89\u88c5Python\u7684\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6cd5<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u5b89\u88c5Python\u7684\u8fc7\u7a0b\u4e2d\uff0c\u60a8\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u53ca\u5176\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u5b89\u88c5\u8def\u5f84\u4e0d\u53ef\u7528<\/strong>\uff1a\u5982\u679c\u60a8\u5728\u6307\u5b9a\u5b89\u88c5\u8def\u5f84\u65f6\u6536\u5230\u9519\u8bef\u6d88\u606f\uff0c\u53ef\u80fd\u662f\u56e0\u4e3a\u60a8\u6ca1\u6709\u76f8\u5e94\u7684\u6743\u9650\u3002\u8bf7\u786e\u4fdd\u60a8\u6709\u6743\u8bbf\u95ee\u548c\u5199\u5165\u6307\u5b9a\u7684\u5b89\u88c5\u76ee\u5f55\u3002\u5982\u679c\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u60a8\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3002<\/li>\n<li><strong>\u547d\u4ee4\u63d0\u793a\u7b26\u65e0\u6cd5\u8bc6\u522bPython\u547d\u4ee4<\/strong>\uff1a\u5982\u679c\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165\u201cpython &#8211;version\u201d\u65f6\u6536\u5230\u9519\u8bef\u6d88\u606f\uff0c\u53ef\u80fd\u662f\u56e0\u4e3aPython\u672a\u6b63\u786e\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u60a8\u53ef\u4ee5\u624b\u52a8\u5c06Python\u7684\u5b89\u88c5\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u6216\u8005\u5728\u5b89\u88c5\u7a0b\u5e8f\u4e2d\u91cd\u65b0\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\u5e76\u91cd\u65b0\u5b89\u88c5\u3002<\/li>\n<li><strong>\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u9519\u8bef\u6d88\u606f<\/strong>\uff1a\u5982\u679c\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u6536\u5230\u9519\u8bef\u6d88\u606f\uff0c\u8bf7\u4ed4\u7ec6\u9605\u8bfb\u9519\u8bef\u6d88\u606f\u5185\u5bb9\uff0c\u5e76\u6839\u636e\u63d0\u793a\u8fdb\u884c\u76f8\u5e94\u7684\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u4e0b\u8f7d\u5e76\u5b89\u88c5\u67d0\u4e9b\u5fc5\u9700\u7684\u4f9d\u8d56\u9879\uff0c\u6216\u8005\u68c0\u67e5\u60a8\u7684\u64cd\u4f5c\u7cfb\u7edf\u662f\u5426\u6ee1\u8db3Python\u7684\u6700\u4f4e\u7cfb\u7edf\u8981\u6c42\u3002<\/li>\n<\/ol>\n<p><p><strong>Python\u5b89\u88c5\u540e\u7684\u914d\u7f6e\u4e0e\u4f7f\u7528<\/strong><\/p>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u5e76\u9a8c\u8bc1\u6210\u529f\u540e\uff0c\u60a8\u53ef\u4ee5\u5f00\u59cb\u914d\u7f6e\u548c\u4f7f\u7528Python\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u57fa\u672c\u7684\u914d\u7f6e\u4e0e\u4f7f\u7528\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u914d\u7f6e\u865a\u62df\u73af\u5883<\/strong>\uff1a\u4e3a\u4e86\u907f\u514d\u4e0d\u540c\u9879\u76ee\u4e4b\u95f4\u7684\u4f9d\u8d56\u51b2\u7a81\uff0c\u5efa\u8bae\u60a8\u4f7f\u7528\u865a\u62df\u73af\u5883\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528Python\u5185\u7f6e\u7684<code>venv<\/code>\u6a21\u5757\u521b\u5efa\u865a\u62df\u73af\u5883\u3002\u4ee5\u4e0b\u662f\u521b\u5efa\u865a\u62df\u73af\u5883\u7684\u6b65\u9aa4\uff1a<\/li>\n<\/ol>\n<p><pre><code># \u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef<\/p>\n<h2><strong>\u8fdb\u5165\u60a8\u7684\u9879\u76ee\u76ee\u5f55<\/strong><\/h2>\n<p>cd path\\to\\your\\project<\/p>\n<h2><strong>\u521b\u5efa\u865a\u62df\u73af\u5883<\/strong><\/h2>\n<p>python -m venv venv<\/p>\n<h2><strong>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff08Windows\u7cfb\u7edf\uff09<\/strong><\/h2>\n<p>venv\\Scripts\\activate<\/p>\n<h2><strong>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff08macOS\u548cLinux\u7cfb\u7edf\uff09<\/strong><\/h2>\n<p>source venv\/bin\/activate<\/p>\n<h2><strong>\u505c\u7528\u865a\u62df\u73af\u5883<\/strong><\/h2>\n<p>deactivate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li><strong>\u5b89\u88c5\u4f9d\u8d56\u5305<\/strong>\uff1a\u5728\u865a\u62df\u73af\u5883\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5\u6240\u9700\u7684\u4f9d\u8d56\u5305\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5<code>requests<\/code>\u5e93\uff1a<\/li>\n<\/ol>\n<p><pre><code>pip install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li><strong>\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801<\/strong>\uff1a\u60a8\u53ef\u4ee5\u4f7f\u7528\u4efb\u4f55\u6587\u672c\u7f16\u8f91\u5668\u6216\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u7f16\u5199Python\u4ee3\u7801\u3002\u5e38\u7528\u7684IDE\u5305\u62ecPyCharm\u3001Visual Studio Code\u548cJupyter Notebook\u3002\u7f16\u5199\u5b8c\u4ee3\u7801\u540e\uff0c\u60a8\u53ef\u4ee5\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u4e2d\u8fd0\u884cPython\u811a\u672c\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fd0\u884c\u540d\u4e3a<code>script.py<\/code>\u7684Python\u811a\u672c\uff1a<\/li>\n<\/ol>\n<p><pre><code>python script.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u603b\u7ed3<\/strong><\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u6210\u529f\u5c06Python\u4e0b\u8f7d\u5e76\u5b89\u88c5\u5230D\u76d8\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u914d\u7f6e\u865a\u62df\u73af\u5883\u3001\u5b89\u88c5\u4f9d\u8d56\u5305\u5e76\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u3002\u5e0c\u671b\u672c\u6587\u5bf9\u60a8\u6709\u6240\u5e2e\u52a9\uff0c\u795d\u60a8\u5728Python\u7f16\u7a0b\u4e4b\u65c5\u4e2d\u53d6\u5f97\u6210\u529f\uff01<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Windows\u4e0a\u5b89\u88c5Python\u5e76\u9009\u62e9D\u76d8\u4f5c\u4e3a\u5b89\u88c5\u76ee\u5f55\uff1f<\/strong><br \/>\u5728Windows\u64cd\u4f5c\u7cfb\u7edf\u4e0a\uff0c\u5b89\u88c5Python\u65f6\u53ef\u4ee5\u81ea\u5b9a\u4e49\u5b89\u88c5\u76ee\u5f55\u3002\u4e0b\u8f7dPython\u5b89\u88c5\u7a0b\u5e8f\u540e\uff0c\u8fd0\u884c\u5b83\u3002\u5728\u5b89\u88c5\u5411\u5bfc\u4e2d\uff0c\u5f53\u4f60\u5230\u8fbe\u201c\u9009\u62e9\u5b89\u88c5\u4f4d\u7f6e\u201d\u6b65\u9aa4\u65f6\uff0c\u53ef\u4ee5\u70b9\u51fb\u201cBrowse\u201d\u6309\u94ae\uff0c\u9009\u62e9D\u76d8\u7684\u6587\u4ef6\u5939\u4f5c\u4e3a\u5b89\u88c5\u4f4d\u7f6e\u3002\u786e\u4fdd\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9009\u62e9\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u4ee5\u4fbf\u4e8e\u540e\u7eed\u4f7f\u7528\u3002<\/p>\n<p><strong>\u6211\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u5728D\u76d8\u5b89\u88c5Python\u5417\uff1f<\/strong><br \/>\u53ef\u4ee5\u3002\u5728Windows\u547d\u4ee4\u884c\u4e2d\uff0c\u9996\u5148\u9700\u8981\u4e0b\u8f7dPython\u7684\u5b89\u88c5\u7a0b\u5e8f\uff08.exe\u6587\u4ef6\uff09\uff0c\u7136\u540e\u901a\u8fc7\u547d\u4ee4\u884c\u5bfc\u822a\u5230\u8be5\u6587\u4ef6\u5939\u3002\u63a5\u7740\u8fd0\u884c\u547d\u4ee4\uff0c\u4f8b\u5982<code>python-3.x.x.exe \/quiet InstallAllUsers=1 PrependPath=1 TargetDir=D:\\Python<\/code>\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u5c06Python\u5b89\u88c5\u5230D\u76d8\u7684\u6307\u5b9a\u6587\u4ef6\u5939\u4e2d\u3002<\/p>\n<p><strong>\u5728D\u76d8\u5b89\u88c5Python\u540e\uff0c\u5982\u4f55\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\uff1f<\/strong><br \/>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u63d0\u793a\u7b26\u9a8c\u8bc1Python\u662f\u5426\u6210\u529f\u5b89\u88c5\u3002\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u8f93\u5165<code>python --version<\/code>\u6216<code>python -V<\/code>\uff0c\u5982\u679c\u5b89\u88c5\u6210\u529f\uff0c\u7cfb\u7edf\u5c06\u663e\u793aPython\u7684\u7248\u672c\u53f7\u3002\u540c\u65f6\uff0c\u53ef\u4ee5\u8f93\u5165<code>pip --version<\/code>\u6765\u68c0\u67e5\u5305\u7ba1\u7406\u5de5\u5177pip\u662f\u5426\u4e5f\u6210\u529f\u5b89\u88c5\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728D\u76d8\u5b89\u88c5Python\u7684\u76f8\u5173\u5e93\u548c\u6a21\u5757\uff1f<\/strong><br \/>\u5728D\u76d8\u5b89\u88c5Python\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528pip\u6765\u5b89\u88c5\u6240\u9700\u7684\u5e93\u548c\u6a21\u5757\u3002\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165<code>pip install package_name<\/code>\uff08\u5c06<code>package_name<\/code>\u66ff\u6362\u4e3a\u5b9e\u9645\u9700\u8981\u5b89\u88c5\u7684\u5e93\u540d\uff09\uff0cpip\u4f1a\u81ea\u52a8\u4e0b\u8f7d\u5e76\u5b89\u88c5\u8be5\u5e93\u5230Python\u73af\u5883\u4e2d\u3002\u5982\u679c\u9700\u8981\u5c06\u5e93\u5b89\u88c5\u5230\u7279\u5b9a\u7684\u76ee\u5f55\uff0c\u53ef\u4ee5\u4f7f\u7528<code>--target<\/code>\u9009\u9879\u6307\u5b9a\u8def\u5f84\uff0c\u4f8b\u5982<code>pip install package_name --target=D:\\Python\\Lib\\site-packages<\/code>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5c06Python\u4e0b\u8f7d\u5230D\u76d8\u7684\u6b65\u9aa4\uff1a\u4e0b\u8f7dPython\u5b89\u88c5\u5305\u3001\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3001\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5\u3001\u6307\u5b9aD\u76d8\u4f5c\u4e3a\u5b89\u88c5\u76ee\u5f55\u3001\u5b8c [&hellip;]","protected":false},"author":3,"featured_media":1063601,"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\/1063591"}],"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=1063591"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1063591\/revisions"}],"predecessor-version":[{"id":1063602,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1063591\/revisions\/1063602"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1063601"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1063591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1063591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1063591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}