{"id":960324,"date":"2024-12-27T03:48:44","date_gmt":"2024-12-26T19:48:44","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/960324.html"},"modified":"2024-12-27T03:48:46","modified_gmt":"2024-12-26T19:48:46","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8notepad%e6%89%93%e5%bc%80python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/960324.html","title":{"rendered":"\u5982\u4f55\u4f7f\u7528notepad\u6253\u5f00python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25102852\/947cce80-ad3f-4edf-ac89-1e6437128c87.webp\" alt=\"\u5982\u4f55\u4f7f\u7528notepad\u6253\u5f00python\" \/><\/p>\n<p><p> <strong>\u8981\u4f7f\u7528Notepad\u6253\u5f00Python\u4ee3\u7801\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u9996\u5148\uff0c\u786e\u4fdd\u5df2\u5b89\u88c5Python\u89e3\u91ca\u5668\u3001\u5176\u6b21\uff0c\u6253\u5f00Notepad\u5e76\u7f16\u5199\u6216\u7c98\u8d34Python\u4ee3\u7801\u3001\u7136\u540e\uff0c\u5c06\u6587\u4ef6\u4fdd\u5b58\u4e3a.py\u683c\u5f0f\u3001\u6700\u540e\uff0c\u901a\u8fc7\u547d\u4ee4\u63d0\u793a\u7b26\u8fd0\u884c\u8be5\u6587\u4ef6\u3002<\/strong>\u5b89\u88c5Python\u89e3\u91ca\u5668\u662f\u4e00\u4e2a\u5fc5\u8981\u7684\u6b65\u9aa4\uff0c\u56e0\u4e3a\u5b83\u662f\u8fd0\u884cPython\u4ee3\u7801\u7684\u57fa\u7840\u3002\u53ef\u4ee5\u4ecePython\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684Python\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u901a\u8fc7\u8f93\u5165<code>python --version<\/code>\u6765\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u63a2\u8ba8\u6bcf\u4e2a\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u5b89\u88c5Python\u89e3\u91ca\u5668<\/h3>\n<\/p>\n<p><p>\u5728\u4f7f\u7528Notepad\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5\u4e86Python\u89e3\u91ca\u5668\u3002Python\u89e3\u91ca\u5668\u662f\u7528\u4e8e\u8fd0\u884cPython\u4ee3\u7801\u7684\u5fc5\u5907\u5de5\u5177\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4e0b\u8f7dPython\u89e3\u91ca\u5668<\/strong><\/p>\n<\/p>\n<p><p>\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%EF%BC%8C%E5%9C%A8%E4%B8%8B%E8%BD%BD%E9%A1%B5%E9%9D%A2%E9%80%89%E6%8B%A9%E9%80%82%E5%90%88%E6%82%A8%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%9A%84Python%E7%89%88%E6%9C%AC%E3%80%82%E9%80%9A%E5%B8%B8%EF%BC%8C%E5%BB%BA%E8%AE%AE%E4%B8%8B%E8%BD%BD%E6%9C%80%E6%96%B0%E7%9A%84%E7%A8%B3%E5%AE%9A%E7%89%88%E6%9C%AC%E3%80%82\">https:\/\/www.python.org\/\uff09\uff0c\u5728\u4e0b\u8f7d\u9875\u9762\u9009\u62e9\u9002\u5408\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684Python\u7248\u672c\u3002\u901a\u5e38\uff0c\u5efa\u8bae\u4e0b\u8f7d\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u3002<\/a><\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5Python\u89e3\u91ca\u5668<\/strong><\/p>\n<\/p>\n<p><p>\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u52a1\u5fc5\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u5c06\u4f7f\u60a8\u80fd\u591f\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u76f4\u63a5\u8fd0\u884cPython\u547d\u4ee4\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong><\/p>\n<\/p>\n<p><p>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08Windows\u4e0b\u53ef\u4ee5\u901a\u8fc7\u6309Win+R\u952e\u5e76\u8f93\u5165cmd\u6253\u5f00\uff09\u3002\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u9a8c\u8bc1Python\u662f\u5426\u5b89\u88c5\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\u60a8\u5c06\u770b\u5230Python\u7248\u672c\u53f7\u7684\u8f93\u51fa\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e8c\u3001\u4f7f\u7528Notepad\u7f16\u5199Python\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>\u6709\u4e86Python\u89e3\u91ca\u5668\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528Notepad\u7f16\u5199Python\u4ee3\u7801\u3002Notepad\u662fWindows\u7cfb\u7edf\u81ea\u5e26\u7684\u7b80\u5355\u6587\u672c\u7f16\u8f91\u5668\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00Notepad<\/strong><\/p>\n<\/p>\n<p><p>\u60a8\u53ef\u4ee5\u901a\u8fc7\u5728Windows\u641c\u7d22\u680f\u4e2d\u8f93\u5165\u201cNotepad\u201d\u6253\u5f00\u8be5\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u5199\u6216\u7c98\u8d34Python\u4ee3\u7801<\/strong><\/p>\n<\/p>\n<p><p>\u5728Notepad\u4e2d\u7f16\u5199\u60a8\u7684Python\u4ee3\u7801\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684Python\u4ee3\u7801\u793a\u4f8b\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>\u5982\u679c\u60a8\u5df2\u6709Python\u4ee3\u7801\uff0c\u53ef\u4ee5\u76f4\u63a5\u7c98\u8d34\u5230Notepad\u4e2d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4fdd\u5b58\u6587\u4ef6\u4e3a.py\u683c\u5f0f<\/strong><\/p>\n<\/p>\n<p><p>\u7f16\u5199\u6216\u7c98\u8d34\u4ee3\u7801\u540e\uff0c\u5355\u51fb\u201c\u6587\u4ef6\u201d\u83dc\u5355\uff0c\u7136\u540e\u9009\u62e9\u201c\u53e6\u5b58\u4e3a\u201d\u3002\u5728\u6587\u4ef6\u540d\u540e\u8f93\u5165\u201c.py\u201d\u6269\u5c55\u540d\uff0c\u4f8b\u5982\u201chello_world.py\u201d\uff0c\u786e\u4fdd\u6587\u4ef6\u7c7b\u578b\u9009\u62e9\u4e3a\u201c\u6240\u6709\u6587\u4ef6\u201d\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u901a\u8fc7\u547d\u4ee4\u63d0\u793a\u7b26\u8fd0\u884cPython\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u4fdd\u5b58\u597dPython\u6587\u4ef6\u540e\uff0c\u4e0b\u4e00\u6b65\u662f\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8fd0\u884c\u8be5\u6587\u4ef6\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26<\/strong><\/p>\n<\/p>\n<p><p>\u518d\u6b21\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5bfc\u822a\u5230\u6587\u4ef6\u6240\u5728\u76ee\u5f55<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u5bfc\u822a\u5230Python\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u7684\u6587\u4ef6\u4fdd\u5b58\u5728\u684c\u9762\u4e0a\uff0c\u53ef\u4ee5\u8f93\u5165\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">cd Desktop<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884cPython\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u8fd0\u884cPython\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python hello_world.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u6587\u4ef6\u8def\u5f84\u6b63\u786e\u4e14Python\u5b89\u88c5\u6210\u529f\uff0c\u60a8\u5c06\u770b\u5230\u4ee3\u7801\u7684\u8f93\u51fa\u7ed3\u679c\uff0c\u4f8b\u5982\u201cHello, World!\u201d\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u6ce8\u610f\u4e8b\u9879\u548c\u6700\u4f73\u5b9e\u8df5<\/h3>\n<\/p>\n<p><p>\u5728\u4f7f\u7528Notepad\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u65f6\uff0c\u8fd8\u6709\u4e00\u4e9b\u6ce8\u610f\u4e8b\u9879\u548c\u6700\u4f73\u5b9e\u8df5\u9700\u8981\u8003\u8651\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528\u4ee3\u7801\u9ad8\u4eae\u548c\u81ea\u52a8\u7f29\u8fdb\u5de5\u5177<\/strong><\/p>\n<\/p>\n<p><p>\u867d\u7136Notepad\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u6587\u672c\u7f16\u8f91\u5668\uff0c\u4f46\u5b83\u4e0d\u652f\u6301\u4ee3\u7801\u9ad8\u4eae\u548c\u81ea\u52a8\u7f29\u8fdb\u3002\u53ef\u4ee5\u8003\u8651\u4f7f\u7528Notepad++\u3001VS Code\u7b49\u66f4\u9ad8\u7ea7\u7684\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7f16\u5199\u7684\u6548\u7387\u548c\u53ef\u8bfb\u6027\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u786e\u4fdd\u4ee3\u7801\u7684\u6b63\u786e\u6027<\/strong><\/p>\n<\/p>\n<p><p>\u7f16\u5199\u4ee3\u7801\u65f6\uff0c\u52a1\u5fc5\u6ce8\u610f\u8bed\u6cd5\u7684\u6b63\u786e\u6027\u3002Python\u5bf9\u7f29\u8fdb\u8981\u6c42\u4e25\u683c\uff0c\u9519\u8bef\u7684\u7f29\u8fdb\u53ef\u80fd\u5bfc\u81f4\u4ee3\u7801\u65e0\u6cd5\u8fd0\u884c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b9a\u671f\u6d4b\u8bd5\u548c\u8c03\u8bd5<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u7f16\u5199\u4ee3\u7801\u7684\u8fc7\u7a0b\u4e2d\uff0c\u5efa\u8bae\u5b9a\u671f\u8fd0\u884c\u4ee3\u7801\u4ee5\u6d4b\u8bd5\u5176\u529f\u80fd\uff0c\u5e76\u5728\u5fc5\u8981\u65f6\u8fdb\u884c\u8c03\u8bd5\u3002\u8fd9\u6709\u52a9\u4e8e\u53ca\u65e9\u53d1\u73b0\u5e76\u89e3\u51b3\u6f5c\u5728\u7684\u95ee\u9898\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b66\u4e60Python\u57fa\u7840<\/strong><\/p>\n<\/p>\n<p><p>\u5982\u679c\u60a8\u662fPython\u65b0\u624b\uff0c\u5efa\u8bae\u5b66\u4e60Python\u7684\u57fa\u672c\u8bed\u6cd5\u548c\u6982\u5ff5\u3002\u8fd9\u5c06\u5e2e\u52a9\u60a8\u66f4\u597d\u5730\u7406\u89e3\u548c\u7f16\u5199Python\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u6210\u529f\u5730\u4f7f\u7528Notepad\u6253\u5f00\u3001\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u3002\u5c3d\u7ba1Notepad\u529f\u80fd\u7b80\u5355\uff0c\u4f46\u5b83\u53ef\u4ee5\u4f5c\u4e3a\u521d\u5b66\u8005\u5b66\u4e60Python\u7684\u8d77\u70b9\u3002\u5728\u719f\u6089Python\u57fa\u7840\u540e\uff0c\u53ef\u4ee5\u9009\u62e9\u66f4\u4e13\u4e1a\u7684IDE\u6765\u63d0\u9ad8\u7f16\u7a0b\u6548\u7387\u548c\u4f53\u9a8c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Notepad\u7f16\u5199\u548c\u4fdd\u5b58Python\u4ee3\u7801\uff1f<\/strong><br \/>\u8981\u5728Notepad\u4e2d\u7f16\u5199Python\u4ee3\u7801\uff0c\u60a8\u53ef\u4ee5\u6253\u5f00Notepad\uff0c\u8f93\u5165\u60a8\u7684\u4ee3\u7801\uff0c\u4f8b\u5982\u201cprint(&#39;Hello, World!&#39;)\u201d\u3002\u5b8c\u6210\u540e\uff0c\u901a\u8fc7\u201c\u6587\u4ef6\u201d\u83dc\u5355\u9009\u62e9\u201c\u4fdd\u5b58\u201d\uff0c\u786e\u4fdd\u5c06\u6587\u4ef6\u6269\u5c55\u540d\u8bbe\u7f6e\u4e3a\u201c.py\u201d\uff0c\u4f8b\u5982\u201chello.py\u201d\u3002\u8fd9\u6837\uff0c\u60a8\u5c31\u521b\u5efa\u4e86\u4e00\u4e2aPython\u811a\u672c\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e0b\u8fd0\u884c\u3002<\/p>\n<p><strong>\u5728Notepad\u4e2d\u6253\u5f00Python\u6587\u4ef6\u65f6\u9047\u5230\u95ee\u9898\uff0c\u8be5\u5982\u4f55\u89e3\u51b3\uff1f<\/strong><br \/>\u5982\u679c\u5728Notepad\u4e2d\u6253\u5f00Python\u6587\u4ef6\u65f6\u65e0\u6cd5\u770b\u5230\u4ee3\u7801\uff0c\u53ef\u80fd\u662f\u6587\u4ef6\u6269\u5c55\u540d\u672a\u6b63\u786e\u8bbe\u7f6e\u3002\u786e\u4fdd\u6587\u4ef6\u4f7f\u7528\u201c.py\u201d\u6269\u5c55\u540d\uff0c\u540c\u65f6\u5728Notepad\u4e2d\u9009\u62e9\u201c\u67e5\u770b\u201d\u83dc\u5355\uff0c\u786e\u4fdd\u201c\u6362\u884c\u7b26\u201d\u9009\u9879\u88ab\u9009\u4e2d\uff0c\u8fd9\u6837\u53ef\u4ee5\u66f4\u597d\u5730\u663e\u793a\u4ee3\u7801\u683c\u5f0f\u3002\u5982\u679c\u95ee\u9898\u4f9d\u7136\u5b58\u5728\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u7528\u5176\u4ed6\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\uff0c\u4f8b\u5982Notepad++\u3002<\/p>\n<p><strong>\u4f7f\u7528Notepad\u7f16\u5199Python\u4ee3\u7801\u65f6\uff0c\u5982\u4f55\u786e\u4fdd\u4ee3\u7801\u7684\u6b63\u786e\u6027\uff1f<\/strong><br \/>\u5728Notepad\u4e2d\u7f16\u5199Python\u4ee3\u7801\u65f6\uff0c\u786e\u4fdd\u4ee3\u7801\u7684\u6b63\u786e\u6027\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u68c0\u67e5\u548c\u6d4b\u8bd5\u6765\u5b9e\u73b0\u3002\u5efa\u8bae\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e0b\u8fd0\u884c\u4ee3\u7801\uff0c\u67e5\u770b\u662f\u5426\u6709\u9519\u8bef\u8f93\u51fa\u3002\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u5728\u7ebfPython\u89e3\u91ca\u5668\u6216\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u6765\u6d4b\u8bd5\u4ee3\u7801\uff0c\u786e\u4fdd\u6240\u6709\u529f\u80fd\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u4f7f\u7528Notepad\u6253\u5f00Python\u4ee3\u7801\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u9996\u5148\uff0c\u786e\u4fdd\u5df2\u5b89\u88c5Python\u89e3\u91ca\u5668\u3001\u5176\u6b21\uff0c\u6253\u5f00No [&hellip;]","protected":false},"author":3,"featured_media":960339,"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\/960324"}],"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=960324"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/960324\/revisions"}],"predecessor-version":[{"id":960340,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/960324\/revisions\/960340"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/960339"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=960324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=960324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=960324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}