{"id":978231,"date":"2024-12-27T06:36:02","date_gmt":"2024-12-26T22:36:02","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/978231.html"},"modified":"2024-12-27T06:36:04","modified_gmt":"2024-12-26T22:36:04","slug":"%e5%a6%82%e4%bd%95%e6%89%93%e5%bc%80python3-8","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/978231.html","title":{"rendered":"\u5982\u4f55\u6253\u5f00python3.8"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24203323\/e38d2b42-8373-4b91-bfdd-1ecf2b2ab6bc.webp\" alt=\"\u5982\u4f55\u6253\u5f00python3.8\" \/><\/p>\n<p><p> <strong>\u8981\u6253\u5f00Python 3.8\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a\u4f7f\u7528\u547d\u4ee4\u884c\u542f\u52a8Python\u89e3\u91ca\u5668\u3001\u901a\u8fc7Python IDE\u8fd0\u884c\u3001\u5728\u6587\u672c\u7f16\u8f91\u5668\u4e2d\u7f16\u5199\u5e76\u6267\u884cPython\u811a\u672c<\/strong>\u3002\u5176\u4e2d\uff0c<strong>\u4f7f\u7528\u547d\u4ee4\u884c\u542f\u52a8Python\u89e3\u91ca\u5668<\/strong>\u662f\u6700\u5e38\u7528\u548c\u76f4\u63a5\u7684\u65b9\u6cd5\u3002\u6253\u5f00\u547d\u4ee4\u884c\u754c\u9762\uff08Windows\u4e0a\u7684\u547d\u4ee4\u63d0\u793a\u7b26\u3001macOS\u4e0a\u7684\u7ec8\u7aef\u6216Linux\u4e0a\u7684\u7ec8\u7aef\uff09\uff0c\u7136\u540e\u8f93\u5165<code>python3.8<\/code>\u5e76\u6309\u4e0b\u56de\u8f66\u952e\uff0c\u5373\u53ef\u542f\u52a8Python 3.8\u89e3\u91ca\u5668\u3002\u6b64\u65f6\uff0c\u4f60\u53ef\u4ee5\u5728\u89e3\u91ca\u5668\u4e2d\u76f4\u63a5\u8f93\u5165Python\u4ee3\u7801\u8fdb\u884c\u4ea4\u4e92\u5f0f\u7f16\u7a0b\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u6267\u884cPython\u811a\u672c\u6765\u8fd0\u884c\u7a0b\u5e8f\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u901a\u8fc7\u4e0d\u540c\u7684\u65b9\u6cd5\u6253\u5f00\u548c\u4f7f\u7528Python 3.8\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u542f\u52a8Python 3.8\u89e3\u91ca\u5668<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u547d\u4ee4\u884c\u542f\u52a8Python\u89e3\u91ca\u5668\u662f\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u4e4b\u4e00\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u5728\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u542f\u52a8Python 3.8\u89e3\u91ca\u5668\u7684\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><h4>1. Windows\u7cfb\u7edf<\/h4>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26<\/strong>\uff1a\u5728Windows\u64cd\u4f5c\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u6309\u4e0b<code>Win + R<\/code>\u952e\u6253\u5f00\u8fd0\u884c\u5bf9\u8bdd\u6846\uff0c\u7136\u540e\u8f93\u5165<code>cmd<\/code>\u5e76\u6309\u56de\u8f66\u952e\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u542f\u52a8Python 3.8\u89e3\u91ca\u5668<\/strong>\uff1a\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\uff0c\u8f93\u5165<code>python3.8<\/code>\u6216<code>py -3.8<\/code>\uff08\u5982\u679c\u4f7f\u7528\u7684\u662fPython Launcher\uff09\uff0c\u7136\u540e\u6309\u4e0b\u56de\u8f66\u952e\u3002\u5982\u679cPython 3.8\u5b89\u88c5\u6b63\u786e\uff0c\u89e3\u91ca\u5668\u5c06\u542f\u52a8\uff0c\u663e\u793aPython\u7684\u7248\u672c\u4fe1\u606f\u548c\u63d0\u793a\u7b26<code>&gt;&gt;&gt;<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1Python\u7248\u672c<\/strong>\uff1a\u53ef\u4ee5\u8f93\u5165<code>import sys<\/code>\uff0c\u7136\u540e\u8f93\u5165<code>sys.version<\/code>\u6765\u786e\u8ba4\u5f53\u524d\u6b63\u5728\u4f7f\u7528\u7684Python\u7248\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h4>2. macOS\u548cLinux\u7cfb\u7edf<\/h4>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u7ec8\u7aef<\/strong>\uff1a\u5728macOS\u4e0a\uff0c\u53ef\u4ee5\u901a\u8fc7\u6309\u4e0b<code>Command + \u7a7a\u683c<\/code>\u952e\u6253\u5f00Spotlight\u641c\u7d22\uff0c\u7136\u540e\u8f93\u5165\u201c\u7ec8\u7aef\u201d\u5e76\u6309\u56de\u8f66\u952e\u3002\u5728Linux\u4e0a\uff0c\u53ef\u4ee5\u901a\u8fc7\u5feb\u6377\u952e<code>Ctrl + Alt + T<\/code>\u6253\u5f00\u7ec8\u7aef\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u542f\u52a8Python 3.8\u89e3\u91ca\u5668<\/strong>\uff1a\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>python3.8<\/code>\u5e76\u6309\u56de\u8f66\u952e\u3002\u5982\u679cPython 3.8\u5b89\u88c5\u6b63\u786e\uff0c\u89e3\u91ca\u5668\u5c06\u542f\u52a8\uff0c\u663e\u793aPython\u7684\u7248\u672c\u4fe1\u606f\u548c\u63d0\u793a\u7b26<code>&gt;&gt;&gt;<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1Python\u7248\u672c<\/strong>\uff1a\u53ef\u4ee5\u8f93\u5165<code>import sys<\/code>\uff0c\u7136\u540e\u8f93\u5165<code>sys.version<\/code>\u6765\u786e\u8ba4\u5f53\u524d\u6b63\u5728\u4f7f\u7528\u7684Python\u7248\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e8c\u3001\u901a\u8fc7Python IDE\u8fd0\u884c<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u662f\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u7684\u53e6\u4e00\u79cd\u5e38\u89c1\u65b9\u6cd5\u3002IDE\u901a\u5e38\u63d0\u4f9b\u4e86\u8bed\u6cd5\u9ad8\u4eae\u3001\u8c03\u8bd5\u3001\u4ee3\u7801\u8865\u5168\u7b49\u529f\u80fd\uff0c\u4f7f\u5f97\u7f16\u7a0b\u66f4\u52a0\u65b9\u4fbf\u3002<\/p>\n<\/p>\n<p><h4>1. PyCharm<\/h4>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5\u5e76\u6253\u5f00PyCharm<\/strong>\uff1a\u4e0b\u8f7d\u5e76\u5b89\u88c5PyCharm\u793e\u533a\u7248\u6216\u4e13\u4e1a\u7248\uff0c\u7136\u540e\u542f\u52a8PyCharm\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u521b\u5efa\u65b0\u9879\u76ee<\/strong>\uff1a\u9009\u62e9\u201cCreate New Project\u201d\uff0c\u7136\u540e\u5728Project Interpreter\u9009\u9879\u4e2d\u9009\u62e9Python 3.8\u4f5c\u4e3a\u89e3\u91ca\u5668\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801<\/strong>\uff1a\u5728\u9879\u76ee\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Python\u6587\u4ef6\uff0c\u7f16\u5199\u4ee3\u7801\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u70b9\u51fb\u201cRun\u201d\u6309\u94ae\u6765\u8fd0\u884c\u811a\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h4>2. VSCode<\/h4>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5\u5e76\u6253\u5f00VSCode<\/strong>\uff1a\u4e0b\u8f7d\u5e76\u5b89\u88c5Visual Studio Code\uff0c\u7136\u540e\u542f\u52a8VSCode\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5Python\u6269\u5c55<\/strong>\uff1a\u5728\u6269\u5c55\u5e02\u573a\u4e2d\u641c\u7d22\u5e76\u5b89\u88c5\u201cPython\u201d\u6269\u5c55\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6ePython\u89e3\u91ca\u5668<\/strong>\uff1a\u4f7f\u7528\u547d\u4ee4\u9762\u677f\uff08Ctrl+Shift+P\uff09\uff0c\u8f93\u5165\u201cPython: Select Interpreter\u201d\uff0c\u9009\u62e9Python 3.8\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801<\/strong>\uff1a\u5728\u5de5\u4f5c\u533a\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Python\u6587\u4ef6\uff0c\u7f16\u5199\u4ee3\u7801\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u70b9\u51fb\u53f3\u4e0a\u89d2\u7684\u201cRun\u201d\u6309\u94ae\u6765\u8fd0\u884c\u811a\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u5728\u6587\u672c\u7f16\u8f91\u5668\u4e2d\u7f16\u5199\u5e76\u6267\u884cPython\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u9664\u4e86\u4f7f\u7528IDE\uff0c\u4f60\u8fd8\u53ef\u4ee5\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u7f16\u5199Python\u4ee3\u7801\uff0c\u7136\u540e\u901a\u8fc7\u547d\u4ee4\u884c\u6267\u884cPython\u811a\u672c\u3002<\/p>\n<\/p>\n<p><h4>1. \u7f16\u5199Python\u811a\u672c<\/h4>\n<\/p>\n<ol>\n<li>\n<p><strong>\u9009\u62e9\u6587\u672c\u7f16\u8f91\u5668<\/strong>\uff1a\u53ef\u4ee5\u4f7f\u7528\u4efb\u4f55\u6587\u672c\u7f16\u8f91\u5668\uff0c\u5982Notepad++\u3001Sublime Text\u6216Atom\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u5199Python\u4ee3\u7801<\/strong>\uff1a\u5728\u6587\u672c\u7f16\u8f91\u5668\u4e2d\u8f93\u5165Python\u4ee3\u7801\uff0c\u5e76\u5c06\u6587\u4ef6\u4fdd\u5b58\u4e3a<code>.py<\/code>\u6269\u5c55\u540d\u3002\u4f8b\u5982\uff0c<code>example.py<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h4>2. \u6267\u884cPython\u811a\u672c<\/h4>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u547d\u4ee4\u884c\u754c\u9762<\/strong>\uff1a\u6839\u636e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884cPython\u811a\u672c<\/strong>\uff1a\u5bfc\u822a\u5230Python\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\uff0c\u4f7f\u7528\u547d\u4ee4<code>python3.8 example.py<\/code>\u6765\u6267\u884c\u811a\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u51e0\u79cd\u65b9\u6cd5\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u6253\u5f00\u5e76\u4f7f\u7528Python 3.8\u3002\u65e0\u8bba\u662f\u901a\u8fc7\u547d\u4ee4\u884c\u3001IDE\uff0c\u8fd8\u662f\u6587\u672c\u7f16\u8f91\u5668\uff0c\u9009\u62e9\u6700\u9002\u5408\u4f60\u7684\u65b9\u6cd5\u53ef\u4ee5\u63d0\u9ad8\u7f16\u7a0b\u6548\u7387\u548c\u4f53\u9a8c\u3002\u786e\u4fddPython 3.8\u5df2\u6b63\u786e\u5b89\u88c5\uff0c\u5e76\u6839\u636e\u9700\u8981\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u4fbf\u5728\u5404\u4e2a\u5e73\u53f0\u4e0a\u987a\u5229\u8fd0\u884cPython\u4ee3\u7801\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728\u6211\u7684\u7535\u8111\u4e0a\u5b89\u88c5Python 3.8\uff1f<\/strong><br \/>\u8981\u5728\u7535\u8111\u4e0a\u5b89\u88c5Python 3.8\uff0c\u60a8\u9700\u8981\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff0c\u4e0b\u8f7d\u9002\u5408\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684\u5b89\u88c5\u5305\u3002\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u786e\u4fdd\u9009\u62e9\u5c06Python\u6dfb\u52a0\u5230\u7cfb\u7edfPATH\u7684\u9009\u9879\uff0c\u8fd9\u6837\u60a8\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u76f4\u63a5\u8bbf\u95eePython\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165<code>python --version<\/code>\u6765\u786e\u8ba4\u662f\u5426\u6210\u529f\u5b89\u88c5\u3002<\/p>\n<p><strong>\u6211\u53ef\u4ee5\u5728Jupyter Notebook\u4e2d\u4f7f\u7528Python 3.8\u5417\uff1f<\/strong><br \/>\u5f53\u7136\u53ef\u4ee5\u3002\u8981\u5728Jupyter Notebook\u4e2d\u4f7f\u7528Python 3.8\uff0c\u60a8\u9700\u8981\u786e\u4fdd\u5df2\u5b89\u88c5Jupyter Notebook\u3002\u63a5\u4e0b\u6765\uff0c\u60a8\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Python 3.8\u73af\u5883\uff0c\u5b89\u88c5ipykernel\u5305\uff0c\u5e76\u5c06\u8be5\u73af\u5883\u6ce8\u518c\u5230Jupyter\u4e2d\u3002\u901a\u8fc7\u8f93\u5165\u547d\u4ee4<code>python -m ipykernel install --user --name=python38<\/code>\uff0c\u60a8\u5c31\u53ef\u4ee5\u5728Jupyter Notebook\u4e2d\u9009\u62e9Python 3.8\u4f5c\u4e3a\u5185\u6838\u3002<\/p>\n<p><strong>\u5982\u679c\u6211\u5728\u7ec8\u7aef\u4e2d\u65e0\u6cd5\u6253\u5f00Python 3.8\uff0c\u8be5\u600e\u4e48\u529e\uff1f<\/strong><br \/>\u5982\u679c\u5728\u7ec8\u7aef\u4e2d\u65e0\u6cd5\u6253\u5f00Python 3.8\uff0c\u53ef\u80fd\u662f\u56e0\u4e3aPython\u7684\u5b89\u88c5\u8def\u5f84\u672a\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u60a8\u53ef\u4ee5\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\uff0c\u786e\u4fddPython\u7684\u5b89\u88c5\u76ee\u5f55\u5df2\u7ecf\u5305\u542b\u5728PATH\u4e2d\u3002\u53e6\u4e00\u79cd\u53ef\u80fd\u662f\uff0c\u60a8\u9700\u8981\u4f7f\u7528<code>python3.8<\/code>\u800c\u4e0d\u662f\u7b80\u5355\u7684<code>python<\/code>\u547d\u4ee4\u6765\u542f\u52a8Python 3.8\u3002\u786e\u4fdd\u60a8\u6b63\u786e\u8f93\u5165\u547d\u4ee4\uff0c\u5e76\u68c0\u67e5\u662f\u5426\u6709\u5176\u4ed6\u7248\u672c\u7684Python\u5e72\u6270\u8fd0\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u6253\u5f00Python 3.8\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a\u4f7f\u7528\u547d\u4ee4\u884c\u542f\u52a8Python\u89e3\u91ca\u5668\u3001\u901a\u8fc7Python IDE\u8fd0 [&hellip;]","protected":false},"author":3,"featured_media":978237,"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\/978231"}],"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=978231"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/978231\/revisions"}],"predecessor-version":[{"id":978238,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/978231\/revisions\/978238"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/978237"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=978231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=978231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=978231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}