{"id":1023321,"date":"2024-12-30T14:04:03","date_gmt":"2024-12-30T06:04:03","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1023321.html"},"modified":"2024-12-30T14:04:05","modified_gmt":"2024-12-30T06:04:05","slug":"%e5%a6%82%e4%bd%95%e8%bf%90%e8%a1%8cpython%e7%a8%8b%e5%ba%8f%e8%a7%86%e9%a2%91-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1023321.html","title":{"rendered":"\u5982\u4f55\u8fd0\u884cpython\u7a0b\u5e8f\u89c6\u9891"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/12\/a0b46365-7d66-435e-ae9d-921a78a17ecb.webp?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"\u5982\u4f55\u8fd0\u884cpython\u7a0b\u5e8f\u89c6\u9891\" \/><\/p>\n<p><p> <strong>\u8981\u8fd0\u884cPython\u7a0b\u5e8f\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5Python\u89e3\u91ca\u5668\u3001\u7f16\u5199Python\u4ee3\u7801\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u6216\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u6765\u8fd0\u884c\u4ee3\u7801\u3001\u8c03\u8bd5\u548c\u4f18\u5316\u7a0b\u5e8f\u3002\u8fd9\u91cc\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5b9e\u73b0\u8fd9\u4e9b\u6b65\u9aa4\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u4e00\u3001\u5b89\u88c5Python\u89e3\u91ca\u5668<\/p>\n<p>\u8981\u8fd0\u884c\u4efb\u4f55Python\u7a0b\u5e8f\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5Python\u89e3\u91ca\u5668\u3002\u53ef\u4ee5\u4ecePython\u5b98\u65b9\u7f51\u7ad9\uff08python.org\uff09\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684Python\u3002\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u786e\u4fdd\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u5c06\u4f7f\u5f97Python\u89e3\u91ca\u5668\u5728\u7cfb\u7edf\u7684\u547d\u4ee4\u884c\u4e2d\u53ef\u7528\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u7f16\u5199Python\u4ee3\u7801<\/p>\n<p>\u7f16\u5199Python\u4ee3\u7801\u53ef\u4ee5\u4f7f\u7528\u4efb\u4f55\u6587\u672c\u7f16\u8f91\u5668\u6216\u4e13\u95e8\u7684\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u3002\u5e38\u89c1\u7684\u6587\u672c\u7f16\u8f91\u5668\u5305\u62ecNotepad++\u3001Sublime Text\u548cVisual Studio Code\uff0c\u800c\u5e38\u89c1\u7684IDE\u5305\u62ecPyCharm\u3001Jupyter Notebook\u548cSpyder\u3002\u9009\u62e9\u4e00\u4e2a\u5de5\u5177\u5e76\u7f16\u5199\u4f60\u7684Python\u4ee3\u7801\uff0c\u4f8b\u5982\u4fdd\u5b58\u4e3a<code>hello.py<\/code>\u7684\u7b80\u5355\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello, World!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e09\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u8fd0\u884cPython\u7a0b\u5e8f<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u884c\u5de5\u5177\uff08Windows\u4e0a\u7684\u547d\u4ee4\u63d0\u793a\u7b26CMD\u6216PowerShell\uff0cMac\u548cLinux\u4e0a\u7684\u7ec8\u7aef\uff09\u3002<\/li>\n<li>\u5bfc\u822a\u5230\u4fdd\u5b58Python\u4ee3\u7801\u7684\u76ee\u5f55\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u7684\u4ee3\u7801\u4fdd\u5b58\u5728\u684c\u9762\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a\n<pre><code class=\"language-shell\">cd Desktop<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u4f7f\u7528Python\u89e3\u91ca\u5668\u8fd0\u884c\u4ee3\u7801\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5e76\u6309\u4e0b\u56de\u8f66\uff1a\n<pre><code class=\"language-shell\">python hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p>\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u4f60\u5c06\u770b\u5230\u547d\u4ee4\u884c\u4e2d\u8f93\u51fa\u201cHello, World!\u201d\u3002<\/li>\n<\/p>\n<\/ol>\n<p><p>\u56db\u3001\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u8fd0\u884cPython\u7a0b\u5e8f<\/p>\n<p>IDE\u63d0\u4f9b\u4e86\u8bb8\u591a\u6709\u7528\u7684\u529f\u80fd\uff0c\u5982\u8bed\u6cd5\u9ad8\u4eae\u3001\u4ee3\u7801\u8865\u5168\u3001\u8c03\u8bd5\u5de5\u5177\u7b49\uff0c\u4f7f\u5f00\u53d1\u8fc7\u7a0b\u66f4\u4e3a\u9ad8\u6548\u3002\u4ee5\u4e0b\u4ee5PyCharm\u4e3a\u4f8b\uff0c\u4ecb\u7ecd\u5982\u4f55\u5728IDE\u4e2d\u8fd0\u884cPython\u7a0b\u5e8f\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u4e0b\u8f7d\u5e76\u5b89\u88c5PyCharm\u3002<\/li>\n<li>\u6253\u5f00PyCharm\u5e76\u521b\u5efa\u4e00\u4e2a\u65b0\u9879\u76ee\u3002<\/li>\n<li>\u5728\u9879\u76ee\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684Python\u6587\u4ef6\uff08\u4f8b\u5982<code>hello.py<\/code>\uff09\uff0c\u5e76\u7f16\u5199\u4ee3\u7801\u3002<\/li>\n<li>\u53f3\u952e\u70b9\u51fbPython\u6587\u4ef6\uff0c\u9009\u62e9\u201cRun &#39;hello&#39;\u201d\uff0c\u5c06\u770b\u5230\u8f93\u51fa\u7a97\u53e3\u4e2d\u663e\u793a\u201cHello, World!\u201d\u3002<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u8c03\u8bd5\u548c\u4f18\u5316Python\u7a0b\u5e8f<\/p>\n<p>\u8c03\u8bd5\u662f\u7f16\u7a0b\u8fc7\u7a0b\u4e2d\u5fc5\u4e0d\u53ef\u5c11\u7684\u4e00\u90e8\u5206\uff0cIDE\u901a\u5e38\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u8c03\u8bd5\u5de5\u5177\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u8c03\u8bd5\u548c\u4f18\u5316\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5728IDE\u4e2d\uff0c\u8bbe\u7f6e\u65ad\u70b9\uff1a\u5728\u9700\u8981\u68c0\u67e5\u7684\u4ee3\u7801\u884c\u70b9\u51fb\u884c\u53f7\u5de6\u4fa7\u3002<\/li>\n<li>\u8fd0\u884c\u8c03\u8bd5\u6a21\u5f0f\uff1a\u70b9\u51fb\u8fd0\u884c\u6309\u94ae\u65c1\u8fb9\u7684\u8c03\u8bd5\u6309\u94ae\uff08\u5c0f\u866b\u5b50\u56fe\u6807\uff09\u3002<\/li>\n<li>\u68c0\u67e5\u53d8\u91cf\u548c\u6267\u884c\u6d41\u7a0b\uff1a\u5728\u8c03\u8bd5\u6a21\u5f0f\u4e0b\uff0c\u7a0b\u5e8f\u5c06\u6682\u505c\u5728\u65ad\u70b9\u5904\uff0c\u5141\u8bb8\u4f60\u9010\u6b65\u6267\u884c\u4ee3\u7801\u5e76\u68c0\u67e5\u53d8\u91cf\u7684\u503c\u3002<\/li>\n<li>\u4f18\u5316\u4ee3\u7801\uff1a\u4f7f\u7528\u5de5\u5177\u5982Pylint\u3001black\u3001flake8\u7b49\u6765\u68c0\u67e5\u4ee3\u7801\u98ce\u683c\u548c\u6f5c\u5728\u95ee\u9898\uff0c\u5e76\u8fdb\u884c\u76f8\u5e94\u7684\u4f18\u5316\u3002<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u8fd0\u884cPython\u7a0b\u5e8f\u7684\u89c6\u9891\u6559\u7a0b<\/p>\n<p>\u89c2\u770b\u4e00\u4e9b\u5173\u4e8e\u5982\u4f55\u8fd0\u884cPython\u7a0b\u5e8f\u7684\u5728\u7ebf\u89c6\u9891\u6559\u7a0b\u4e5f\u80fd\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3\u548c\u638c\u63e1\u8fd9\u4e9b\u6b65\u9aa4\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u63a8\u8350\u7684\u8d44\u6e90\uff1a<\/p>\n<\/p>\n<ol>\n<li>YouTube\u641c\u7d22\u201c\u5982\u4f55\u8fd0\u884cPython\u7a0b\u5e8f\u201d\u7684\u89c6\u9891\u6559\u7a0b\u3002<\/li>\n<li>\u5728\u7ebf\u6559\u80b2\u5e73\u53f0\u5982Coursera\u3001Udacity\u3001edX\u7b49\u63d0\u4f9b\u7684Python\u7f16\u7a0b\u8bfe\u7a0b\u3002<\/li>\n<li>\u4e13\u4e1a\u7f51\u7ad9\u5982Real Python\u3001Python.org\u4e0a\u7684\u6587\u6863\u548c\u6559\u7a0b\u3002<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u8fd0\u884c\u548c\u8c03\u8bd5\u4f60\u7684Python\u7a0b\u5e8f\u3002\u65e0\u8bba\u662f\u521d\u5b66\u8005\u8fd8\u662f\u6709\u7ecf\u9a8c\u7684\u5f00\u53d1\u8005\uff0c\u638c\u63e1\u8fd9\u4e9b\u57fa\u672c\u6280\u80fd\u90fd\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u5e0c\u671b\u8fd9\u4e9b\u6307\u5bfc\u80fd\u591f\u5e2e\u52a9\u4f60\u987a\u5229\u8fd0\u884cPython\u7a0b\u5e8f\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\u4ee5\u4fbf\u8fd0\u884c\u7a0b\u5e8f\uff1f<\/strong><br \/>\u5728\u8fd0\u884cPython\u7a0b\u5e8f\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u786e\u4fdd\u5df2\u5728\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5Python\u3002\u60a8\u53ef\u4ee5\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff08python.org\uff09\u4e0b\u8f7d\u9002\u5408\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684\u5b89\u88c5\u5305\u3002\u5b89\u88c5\u8fc7\u7a0b\u7b80\u5355\uff0c\u53ea\u9700\u6309\u7167\u5c4f\u5e55\u4e0a\u7684\u63d0\u793a\u8fdb\u884c\u64cd\u4f5c\u3002\u5b89\u88c5\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u8f93\u5165<code>python --version<\/code>\u6765\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002<\/p>\n<p><strong>\u6211\u53ef\u4ee5\u5728\u54ea\u4e9b\u7f16\u8f91\u5668\u4e2d\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\uff1f<\/strong><br \/>\u6709\u591a\u79cd\u7f16\u8f91\u5668\u548c\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u53ef\u4f9b\u9009\u62e9\uff0c\u4f8b\u5982PyCharm\u3001Visual Studio Code\u3001Jupyter Notebook\u548cSpyder\u7b49\u3002\u8fd9\u4e9b\u5de5\u5177\u63d0\u4f9b\u4e86\u4ee3\u7801\u9ad8\u4eae\u3001\u81ea\u52a8\u8865\u5168\u548c\u8c03\u8bd5\u529f\u80fd\uff0c\u6781\u5927\u5730\u63d0\u9ad8\u4e86\u7f16\u7a0b\u6548\u7387\u3002\u9009\u62e9\u60a8\u6700\u719f\u6089\u6216\u6700\u9002\u5408\u60a8\u9700\u6c42\u7684\u5de5\u5177\uff0c\u5c06\u6709\u52a9\u4e8e\u66f4\u8f7b\u677e\u5730\u7f16\u5199\u548c\u8fd0\u884cPython\u7a0b\u5e8f\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884cPython\u7a0b\u5e8f\uff1f<\/strong><br \/>\u5728\u547d\u4ee4\u884c\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528<code>python \u6587\u4ef6\u540d.py<\/code>\u547d\u4ee4\u6765\u8fd0\u884cPython\u7a0b\u5e8f\u3002\u786e\u4fdd\u60a8\u5df2\u5bfc\u822a\u5230\u5305\u542b\u8be5\u7a0b\u5e8f\u7684\u76ee\u5f55\u3002\u66ff\u6362\u201c\u6587\u4ef6\u540d.py\u201d\u4e3a\u60a8\u7684\u5b9e\u9645Python\u6587\u4ef6\u540d\u3002\u6210\u529f\u6267\u884c\u540e\uff0c\u60a8\u5c06\u770b\u5230\u7a0b\u5e8f\u7684\u8f93\u51fa\u7ed3\u679c\u3002\u786e\u4fdd\u60a8\u7684Python\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u6b63\u786e\uff0c\u4ee5\u4fbf\u5728\u4efb\u4f55\u76ee\u5f55\u4e0b\u90fd\u80fd\u8fd0\u884cPython\u547d\u4ee4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u8fd0\u884cPython\u7a0b\u5e8f\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5Python\u89e3\u91ca\u5668\u3001\u7f16\u5199Python\u4ee3\u7801\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u6216\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE [&hellip;]","protected":false},"author":3,"featured_media":1023327,"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\/1023321"}],"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=1023321"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1023321\/revisions"}],"predecessor-version":[{"id":1023330,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1023321\/revisions\/1023330"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1023327"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1023321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1023321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1023321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}