{"id":945619,"date":"2024-12-26T23:27:37","date_gmt":"2024-12-26T15:27:37","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/945619.html"},"modified":"2024-12-26T23:27:39","modified_gmt":"2024-12-26T15:27:39","slug":"notepad-%e5%a6%82%e4%bd%95%e8%bf%90%e8%a1%8cpython","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/945619.html","title":{"rendered":"notepad \u5982\u4f55\u8fd0\u884cpython"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25082128\/e9456544-da05-48c0-abc9-2a7b052ea0de.webp\" alt=\"notepad \u5982\u4f55\u8fd0\u884cpython\" \/><\/p>\n<p><p> <strong>\u8981\u5728Notepad\u4e2d\u8fd0\u884cPython\u7a0b\u5e8f\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5Python\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u6765\u6267\u884cPython\u6587\u4ef6\u3002<\/strong> \u5176\u4e2d\uff0c\u6700\u91cd\u8981\u7684\u4e00\u6b65\u662f\u5b89\u88c5Python\uff0c\u5e76\u786e\u4fdd\u5b83\u5df2\u6b63\u786e\u914d\u7f6e\u5728\u7cfb\u7edf\u7684PATH\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u63d0\u793a\u7b26\u8f7b\u677e\u5730\u8fd0\u884cPython\u811a\u672c\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u8fd9\u4e9b\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u5b89\u88c5Python<\/p>\n<\/p>\n<p><p>\u8981\u5728Notepad\u4e2d\u8fd0\u884cPython\u7a0b\u5e8f\uff0c\u9996\u5148\u9700\u8981\u5728\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5Python\u3002\u53ef\u4ee5\u4ecePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff08python.org\uff09\u4e0b\u8f7d\u9002\u7528\u4e8e\u64cd\u4f5c\u7cfb\u7edf\u7684Python\u5b89\u88c5\u5305\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4e0b\u8f7dPython\u5b89\u88c5\u7a0b\u5e8f<\/strong>\uff1a\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\uff0c\u4e0b\u8f7d\u9002\u7528\u4e8eWindows\u3001macOS\u6216Linux\u7684Python\u7248\u672c\u3002\u901a\u5e38\uff0c\u9009\u62e9\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u5373\u53ef\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f<\/strong>\uff1a\u53cc\u51fb\u4e0b\u8f7d\u7684\u5b89\u88c5\u7a0b\u5e8f\uff0c\u542f\u52a8\u5b89\u88c5\u5411\u5bfc\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u786e\u4fdd\u9009\u4e2d\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u6837Python\u4f1a\u81ea\u52a8\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b8c\u6210\u5b89\u88c5<\/strong>\uff1a\u6309\u7167\u5b89\u88c5\u5411\u5bfc\u7684\u6307\u5f15\u5b8c\u6210\u5b89\u88c5\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u63d0\u793a\u7b26\u9a8c\u8bc1Python\u662f\u5426\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n<\/p>\n<p><p>\u867d\u7136\u5728\u5b89\u88c5Python\u65f6\u53ef\u4ee5\u81ea\u52a8\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u4f46\u6709\u65f6\u9700\u8981\u624b\u52a8\u68c0\u67e5\u6216\u914d\u7f6e\uff0c\u4ee5\u786e\u4fdd\u80fd\u591f\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8fd0\u884cPython\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u68c0\u67e5Python\u8def\u5f84<\/strong>\uff1a\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08Windows\uff09\u6216\u7ec8\u7aef\uff08macOS\/Linux\uff09\uff0c\u8f93\u5165<code>python --version<\/code>\u6216<code>python3 --version<\/code>\uff0c\u68c0\u67e5\u662f\u5426\u80fd\u591f\u6b63\u786e\u663e\u793aPython\u7248\u672c\u53f7\u3002\u5982\u679c\u663e\u793a\u7248\u672c\u53f7\uff0c\u8bf4\u660e\u914d\u7f6e\u6b63\u786e\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u624b\u52a8\u914d\u7f6e\uff08\u5982\u679c\u9700\u8981\uff09<\/strong>\uff1a\u5982\u679c\u6ca1\u6709\u6b63\u786e\u663e\u793a\uff0c\u53ef\u4ee5\u624b\u52a8\u6dfb\u52a0Python\u8def\u5f84\u3002\u53f3\u952e\u5355\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u201c\u6211\u7684\u7535\u8111\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\uff0c\u7136\u540e\u9009\u62e9\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u3002\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u8f91PATH\u53d8\u91cf<\/strong>\uff1a\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u90e8\u5206\uff0c\u627e\u5230\u5e76\u9009\u62e9\u201cPath\u201d\u53d8\u91cf\uff0c\u7136\u540e\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u3002\u5728\u53d8\u91cf\u503c\u4e2d\u6dfb\u52a0Python\u7684\u5b89\u88c5\u8def\u5f84\uff08\u4f8b\u5982<code>C:\\Python39<\/code>\uff09\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u4f7f\u7528Notepad\u7f16\u5199Python\u4ee3\u7801<\/p>\n<\/p>\n<p><p>Notepad\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u6587\u672c\u7f16\u8f91\u5668\uff0c\u53ef\u4ee5\u7528\u6765\u7f16\u5199Python\u4ee3\u7801\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u4f7f\u7528Notepad\u7f16\u5199Python\u811a\u672c\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00Notepad<\/strong>\uff1a\u5728Windows\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5f00\u59cb\u83dc\u5355\u6216\u641c\u7d22\u680f\u627e\u5230\u5e76\u6253\u5f00Notepad\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u5199Python\u4ee3\u7801<\/strong>\uff1a\u5728Notepad\u4e2d\u8f93\u5165Python\u4ee3\u7801\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello, World!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4fdd\u5b58\u6587\u4ef6<\/strong>\uff1a\u5c06\u6587\u4ef6\u4fdd\u5b58\u4e3a<code>.py<\/code>\u683c\u5f0f\uff0c\u4f8b\u5982<code>hello.py<\/code>\u3002\u786e\u4fdd\u9009\u62e9\u201c\u6240\u6709\u6587\u4ef6\u201d\u4f5c\u4e3a\u4fdd\u5b58\u7c7b\u578b\uff0c\u4ee5\u9632\u6b62\u6587\u4ef6\u88ab\u4fdd\u5b58\u4e3a<code>.txt<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u8fd0\u884cPython\u811a\u672c<\/p>\n<\/p>\n<p><p>\u4e00\u65e6Python\u4ee3\u7801\u5728Notepad\u4e2d\u7f16\u5199\u5e76\u4fdd\u5b58\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u63d0\u793a\u7b26\u8fd0\u884c\u8be5\u811a\u672c\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26<\/strong>\uff1a\u5728Windows\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5f00\u59cb\u83dc\u5355\u6216\u641c\u7d22\u680f\u627e\u5230\u5e76\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5bfc\u822a\u5230\u6587\u4ef6\u76ee\u5f55<\/strong>\uff1a\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u5bfc\u822a\u5230\u4fdd\u5b58Python\u811a\u672c\u7684\u76ee\u5f55\u3002\u4f8b\u5982\uff0c\u5982\u679c\u811a\u672c\u4fdd\u5b58\u5728\u684c\u9762\u4e0a\uff0c\u53ef\u4ee5\u8f93\u5165<code>cd Desktop<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884cPython\u811a\u672c<\/strong>\uff1a\u8f93\u5165<code>python hello.py<\/code>\u6216<code>python3 hello.py<\/code>\uff08\u6839\u636e\u5b89\u88c5\u7684Python\u7248\u672c\uff09\uff0c\u7136\u540e\u6309Enter\u952e\u3002\u6b64\u65f6\uff0cPython\u89e3\u91ca\u5668\u5c06\u6267\u884c\u8be5\u811a\u672c\uff0c\u5e76\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u51fa\u7ed3\u679c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9\u7f16\u8f91\u5668\u6216IDE<\/p>\n<\/p>\n<p><p>\u867d\u7136Notepad\u53ef\u4ee5\u7528\u4e8e\u7f16\u5199\u548c\u8fd0\u884c\u7b80\u5355\u7684Python\u811a\u672c\uff0c\u4f46\u5bf9\u4e8e\u66f4\u590d\u6742\u7684\u9879\u76ee\uff0c\u5efa\u8bae\u4f7f\u7528\u66f4\u5f3a\u5927\u7684\u7f16\u8f91\u5668\u6216IDE\uff0c\u5982Visual Studio Code\u3001PyCharm\u6216Jupyter Notebook\u3002\u8fd9\u4e9b\u5de5\u5177\u63d0\u4f9b\u4e86\u8bed\u6cd5\u9ad8\u4eae\u3001\u4ee3\u7801\u81ea\u52a8\u5b8c\u6210\u3001\u8c03\u8bd5\u7b49\u529f\u80fd\uff0c\u53ef\u4ee5\u5927\u5927\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Visual Studio Code<\/strong>\uff1a\u8fd9\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u5f00\u6e90\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\u3002\u901a\u8fc7\u5b89\u88c5Python\u6269\u5c55\uff0c\u53ef\u4ee5\u4e3aPython\u5f00\u53d1\u63d0\u4f9b\u4e30\u5bcc\u7684\u529f\u80fd\u652f\u6301\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>PyCharm<\/strong>\uff1a\u8fd9\u662f\u4e00\u4e2a\u4e13\u4e1a\u7684Python IDE\uff0c\u63d0\u4f9b\u5168\u9762\u7684Python\u5f00\u53d1\u5de5\u5177\u3002PyCharm\u6709\u793e\u533a\u7248\uff08\u514d\u8d39\uff09\u548c\u4e13\u4e1a\u7248\uff08\u4ed8\u8d39\uff09\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u9009\u62e9\u4f7f\u7528\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Jupyter Notebook<\/strong>\uff1a\u8fd9\u662f\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u5f00\u53d1\u73af\u5883\uff0c\u7279\u522b\u9002\u5408\u6570\u636e\u79d1\u5b66\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u9886\u57df\u3002Jupyter Notebook\u652f\u6301\u5728\u6d4f\u89c8\u5668\u4e2d\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u5728Notepad\u4e2d\u8fd0\u884cPython\u7a0b\u5e8f\u9700\u8981\u5b89\u88c5Python\u5e76\u6b63\u786e\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u867d\u7136Notepad\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u6587\u672c\u7f16\u8f91\u5668\uff0c\u4f46\u5b83\u53ef\u4ee5\u6ee1\u8db3\u57fa\u672c\u7684Python\u5f00\u53d1\u9700\u6c42\u3002\u7136\u800c\uff0c\u5bf9\u4e8e\u66f4\u590d\u6742\u7684\u9879\u76ee\uff0c\u4f7f\u7528\u4e13\u4e1a\u7684\u7f16\u8f91\u5668\u6216IDE\u5c06\u63d0\u4f9b\u66f4\u597d\u7684\u5f00\u53d1\u4f53\u9a8c\u548c\u6548\u7387\u3002\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u5728Notepad\u4e2d\u7f16\u5199\u548c\u8fd0\u884cPython\u811a\u672c\uff0c\u5e76\u9010\u6b65\u8fc7\u6e21\u5230\u66f4\u9ad8\u7ea7\u7684\u5f00\u53d1\u5de5\u5177\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Notepad\u4e2d\u7f16\u5199Python\u4ee3\u7801\uff1f<\/strong><br \/>\u8981\u5728Notepad\u4e2d\u7f16\u5199Python\u4ee3\u7801\uff0c\u53ea\u9700\u6253\u5f00Notepad\uff0c\u8f93\u5165\u60a8\u7684Python\u4ee3\u7801\uff0c\u7136\u540e\u5c06\u6587\u4ef6\u4fdd\u5b58\u4e3a\u4ee5\u201c.py\u201d\u7ed3\u5c3e\u7684\u6587\u4ef6\uff0c\u4f8b\u5982\u201cscript.py\u201d\u3002\u786e\u4fdd\u5728\u4fdd\u5b58\u6587\u4ef6\u65f6\u9009\u62e9\u201c\u6240\u6709\u6587\u4ef6\u201d\u4f5c\u4e3a\u6587\u4ef6\u7c7b\u578b\uff0c\u4ee5\u786e\u4fddNotepad\u4e0d\u4f1a\u5c06\u6587\u4ef6\u4fdd\u5b58\u4e3a\u6587\u672c\u6587\u4ef6\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Notepad\u4e2d\u8fd0\u884cPython\u811a\u672c\uff1f<\/strong><br \/>\u8981\u8fd0\u884cNotepad\u4e2d\u7f16\u5199\u7684Python\u811a\u672c\uff0c\u60a8\u9700\u8981\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002\u4f7f\u7528\u201ccd\u201d\u547d\u4ee4\u5bfc\u822a\u5230\u4fdd\u5b58\u811a\u672c\u7684\u6587\u4ef6\u5939\uff0c\u7136\u540e\u8f93\u5165\u201cpython script.py\u201d\u6765\u6267\u884c\u8be5\u811a\u672c\u3002\u786e\u4fdd\u60a8\u7684\u8ba1\u7b97\u673a\u5df2\u5b89\u88c5Python\uff0c\u5e76\u4e14\u5df2\u5c06Python\u7684\u5b89\u88c5\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/p>\n<p><strong>Notepad\u4e0e\u5176\u4ed6\u4ee3\u7801\u7f16\u8f91\u5668\u76f8\u6bd4\uff0c\u9002\u5408\u7528\u6765\u7f16\u5199Python\u4ee3\u7801\u5417\uff1f<\/strong><br \/>Notepad\u662f\u4e00\u4e2a\u57fa\u672c\u7684\u6587\u672c\u7f16\u8f91\u5668\uff0c\u9002\u5408\u5feb\u901f\u7f16\u5199\u548c\u7f16\u8f91\u7b80\u5355\u7684Python\u811a\u672c\u3002\u7136\u800c\uff0c\u5b83\u7f3a\u4e4f\u8bed\u6cd5\u9ad8\u4eae\u3001\u81ea\u52a8\u5b8c\u6210\u548c\u8c03\u8bd5\u529f\u80fd\u7b49\u9ad8\u7ea7\u7279\u6027\uff0c\u8fd9\u4e9b\u529f\u80fd\u5728\u5176\u4ed6\u4ee3\u7801\u7f16\u8f91\u5668\u5982Visual Studio Code\u6216PyCharm\u4e2d\u4f1a\u66f4\u4e3a\u5f3a\u5927\u3002\u5982\u679c\u60a8\u8ba1\u5212\u8fdb\u884c\u8f83\u590d\u6742\u7684Python\u5f00\u53d1\uff0c\u8003\u8651\u4f7f\u7528\u529f\u80fd\u66f4\u5168\u7684\u7f16\u8f91\u5668\u5c06\u66f4\u4e3a\u4fbf\u5229\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u5728Notepad\u4e2d\u8fd0\u884cPython\u7a0b\u5e8f\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5Python\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u6765\u6267\u884cPyth [&hellip;]","protected":false},"author":3,"featured_media":945625,"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\/945619"}],"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=945619"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/945619\/revisions"}],"predecessor-version":[{"id":945632,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/945619\/revisions\/945632"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/945625"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=945619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=945619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=945619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}