{"id":953148,"date":"2024-12-27T01:40:20","date_gmt":"2024-12-26T17:40:20","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/953148.html"},"modified":"2024-12-27T01:40:22","modified_gmt":"2024-12-26T17:40:22","slug":"windows%e4%b8%8a%e5%a6%82%e4%bd%95%e8%bf%90%e8%a1%8cpython","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/953148.html","title":{"rendered":"windows\u4e0a\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\/25090729\/1042d50d-6d01-419b-94df-a23d2a992468.webp\" alt=\"windows\u4e0a\u5982\u4f55\u8fd0\u884cpython\" \/><\/p>\n<p><p> <strong>\u5728Windows\u4e0a\u8fd0\u884cPython\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u5f0f\uff1a\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u3001\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u3001Python\u811a\u672c\u6587\u4ef6\u3001Jupyter Notebook\u3002\u6bcf\u79cd\u65b9\u5f0f\u90fd\u6709\u5176\u4f18\u70b9\u548c\u9002\u7528\u573a\u666f\uff0c\u5177\u4f53\u9009\u62e9\u89c6\u4e2a\u4eba\u9700\u6c42\u800c\u5b9a\u3002<\/strong>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728Windows\u4e0a\u8fd0\u884cPython\uff0c\u5305\u62ec\u4ece\u4e0b\u8f7d\u548c\u5b89\u88c5Python\uff0c\u5230\u4f7f\u7528\u4e0d\u540c\u5de5\u5177\u548c\u65b9\u6cd5\u6267\u884cPython\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4e0b\u8f7d\u4e0e\u5b89\u88c5Python<\/p>\n<\/p>\n<p><p>\u5728Windows\u4e0a\u8fd0\u884cPython\u7684\u7b2c\u4e00\u6b65\u662f\u4e0b\u8f7d\u548c\u5b89\u88c5Python\u89e3\u91ca\u5668\u3002Python\u7684\u6700\u65b0\u7248\u672c\u53ef\u4ee5\u5728Python\u7684\u5b98\u65b9\u7f51\u7ad9\u4e0a\u4e0b\u8f7d\u3002\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u786e\u4fdd\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u76f4\u63a5\u4f7f\u7528Python\u547d\u4ee4\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4e0b\u8f7dPython<\/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%E7%9A%84Windows%E7%89%88%E6%9C%AC%EF%BC%88%E9%80%9A%E5%B8%B8%E4%B8%BAx86-64%E4%BD%8D%EF%BC%89%E8%BF%9B%E8%A1%8C%E4%B8%8B%E8%BD%BD%E3%80%82%E5%AE%89%E8%A3%85%E5%8C%85%E9%80%9A%E5%B8%B8%E6%98%AF%E4%B8%80%E4%B8%AA%E5%8F%AF%E6%89%A7%E8%A1%8C%E7%9A%84.exe%E6%96%87%E4%BB%B6%E3%80%82\">https:\/\/www.python.org\/\uff09\uff0c\u5728\u4e0b\u8f7d\u9875\u9762\u9009\u62e9\u9002\u5408\u7684Windows\u7248\u672c\uff08\u901a\u5e38\u4e3ax86-64\u4f4d\uff09\u8fdb\u884c\u4e0b\u8f7d\u3002\u5b89\u88c5\u5305\u901a\u5e38\u662f\u4e00\u4e2a\u53ef\u6267\u884c\u7684.exe\u6587\u4ef6\u3002<\/a><\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5Python<\/strong><\/p>\n<\/p>\n<p><p>\u8fd0\u884c\u4e0b\u8f7d\u7684\u5b89\u88c5\u6587\u4ef6\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u5c06\u81ea\u52a8\u5c06Python\u7684\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u8fd9\u6837\uff0c\u60a8\u53ef\u4ee5\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u76f4\u63a5\u8c03\u7528Python\u800c\u4e0d\u9700\u8981\u6307\u5b9a\u5176\u5b8c\u6574\u8def\u5f84\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong><\/p>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08Cmd\uff09\uff0c\u8f93\u5165 <code>python --version<\/code> \u6216 <code>python -V<\/code> \u6765\u9a8c\u8bc1Python\u662f\u5426\u6b63\u786e\u5b89\u88c5\u3002\u5982\u679c\u770b\u5230Python\u7684\u7248\u672c\u53f7\uff0c\u5219\u8868\u793a\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u8fd0\u884cPython<\/p>\n<\/p>\n<p><p>\u547d\u4ee4\u63d0\u793a\u7b26\u662fWindows\u81ea\u5e26\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u53ef\u4ee5\u76f4\u63a5\u7528\u6765\u8fd0\u884cPython\u811a\u672c\u6216\u4ea4\u4e92\u5f0f\u6267\u884cPython\u4ee3\u7801\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u8fdb\u5165Python\u4ea4\u4e92\u6a21\u5f0f<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165 <code>python<\/code>\uff0c\u6309\u4e0b\u56de\u8f66\u952e\u5373\u53ef\u8fdb\u5165Python\u4ea4\u4e92\u6a21\u5f0f\u3002\u5728\u8be5\u6a21\u5f0f\u4e0b\uff0c\u60a8\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165Python\u547d\u4ee4\u5e76\u7acb\u5373\u67e5\u770b\u7ed3\u679c\u3002\u8fd9\u5bf9\u4e8e\u5feb\u901f\u6d4b\u8bd5\u7b80\u5355\u7684Python\u4ee3\u7801\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884cPython\u811a\u672c\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u5982\u679c\u60a8\u6709\u4e00\u4e2aPython\u811a\u672c\u6587\u4ef6\uff08\u5982 <code>script.py<\/code>\uff09\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u901a\u8fc7 <code>python script.py<\/code> \u547d\u4ee4\u6765\u8fd0\u884c\u8be5\u811a\u672c\u3002\u786e\u4fdd\u547d\u4ee4\u63d0\u793a\u7b26\u7684\u5f53\u524d\u8def\u5f84\u4e0e\u811a\u672c\u6587\u4ef6\u6240\u5728\u8def\u5f84\u4e00\u81f4\uff0c\u6216\u8005\u63d0\u4f9b\u811a\u672c\u6587\u4ef6\u7684\u5b8c\u6574\u8def\u5f84\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09<\/p>\n<\/p>\n<p><p>IDE\u63d0\u4f9b\u4e86\u66f4\u4e3a\u53cb\u597d\u7684\u754c\u9762\u548c\u529f\u80fd\uff0c\u9002\u5408\u8fdb\u884c\u590d\u6742\u9879\u76ee\u7684\u5f00\u53d1\u548c\u8c03\u8bd5\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>PyCharm<\/strong><\/p>\n<\/p>\n<p><p>PyCharm\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684Python IDE\uff0c\u652f\u6301\u667a\u80fd\u4ee3\u7801\u8865\u5168\u3001\u8c03\u8bd5\u3001\u6d4b\u8bd5\u7b49\u529f\u80fd\u3002\u5b89\u88c5PyCharm\u540e\uff0c\u60a8\u53ef\u4ee5\u521b\u5efa\u65b0\u9879\u76ee\u6216\u5bfc\u5165\u73b0\u6709\u9879\u76ee\uff0c\u7136\u540e\u5728IDE\u4e2d\u8fd0\u884c\u548c\u8c03\u8bd5Python\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Visual Studio Code<\/strong><\/p>\n<\/p>\n<p><p>Visual Studio Code\uff08VS Code\uff09\u662f\u5fae\u8f6f\u63a8\u51fa\u7684\u4e00\u6b3e\u514d\u8d39\u3001\u5f00\u6e90\u7684\u4ee3\u7801\u7f16\u8f91\u5668\u3002\u901a\u8fc7\u5b89\u88c5Python\u6269\u5c55\uff0cVS Code\u53ef\u4ee5\u63d0\u4f9b\u7c7b\u4f3cIDE\u7684\u529f\u80fd\uff0c\u5982\u4ee3\u7801\u8865\u5168\u3001\u8c03\u8bd5\u3001\u96c6\u6210\u7ec8\u7aef\u7b49\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Spyder<\/strong><\/p>\n<\/p>\n<p><p>Spyder\u662f\u4e13\u4e3a\u79d1\u5b66\u8ba1\u7b97\u8bbe\u8ba1\u7684Python IDE\uff0c\u96c6\u6210\u4e86Matplotlib\u3001NumPy\u3001Pandas\u7b49\u79d1\u5b66\u8ba1\u7b97\u5e93\u3002\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7c7b\u4f3cMATLAB\u7684\u4ea4\u4e92\u5f0f\u73af\u5883\uff0c\u9002\u5408\u6570\u636e\u5206\u6790\u548c\u79d1\u5b66\u8ba1\u7b97\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u521b\u5efa\u548c\u8fd0\u884cPython\u811a\u672c\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08\u5982Notepad++\u3001Sublime Text\u3001VS Code\uff09\u521b\u5efaPython\u811a\u672c\u6587\u4ef6\uff0c\u7136\u540e\u901a\u8fc7\u547d\u4ee4\u63d0\u793a\u7b26\u6216IDE\u8fd0\u884c\u8be5\u6587\u4ef6\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efaPython\u811a\u672c\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u6253\u5f00\u6587\u672c\u7f16\u8f91\u5668\uff0c\u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\u5e76\u7f16\u5199Python\u4ee3\u7801\u3002\u4fdd\u5b58\u6587\u4ef6\u65f6\uff0c\u786e\u4fdd\u6587\u4ef6\u6269\u5c55\u540d\u4e3a <code>.py<\/code>\uff0c\u4f8b\u5982 <code>example.py<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884cPython\u811a\u672c\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u5bfc\u822a\u5230\u811a\u672c\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\uff0c\u7136\u540e\u8f93\u5165 <code>python example.py<\/code> \u6765\u8fd0\u884c\u8be5\u811a\u672c\u3002\u5982\u679c\u4f7f\u7528IDE\uff0c\u5219\u53ef\u4ee5\u76f4\u63a5\u5728IDE\u4e2d\u6253\u5f00\u5e76\u8fd0\u884c\u8be5\u6587\u4ef6\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u4f7f\u7528Jupyter Notebook<\/p>\n<\/p>\n<p><p>Jupyter Notebook\u662f\u4e00\u79cd\u4ea4\u4e92\u5f0f\u8ba1\u7b97\u73af\u5883\uff0c\u5141\u8bb8\u60a8\u5728\u7f51\u9875\u754c\u9762\u4e2d\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\uff0c\u975e\u5e38\u9002\u5408\u6570\u636e\u5206\u6790\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u9879\u76ee\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5Jupyter Notebook<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u4f7f\u7528 <code>pip install jupyter<\/code> \u547d\u4ee4\u6765\u5b89\u88c5Jupyter Notebook\u3002\u786e\u4fdd\u60a8\u7684Python\u73af\u5883\u4e2d\u5df2\u5b89\u88c5pip\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u542f\u52a8Jupyter Notebook<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165 <code>jupyter notebook<\/code>\uff0c\u8fd9\u5c06\u542f\u52a8Jupyter\u670d\u52a1\u5668\uff0c\u5e76\u5728\u9ed8\u8ba4\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00Jupyter Notebook\u754c\u9762\u3002\u5728\u8be5\u754c\u9762\u4e2d\uff0c\u60a8\u53ef\u4ee5\u521b\u5efa\u65b0\u7684Notebook\uff0c\u7f16\u5199\u5e76\u8fd0\u884cPython\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u5199\u548c\u8fd0\u884c\u4ee3\u7801<\/strong><\/p>\n<\/p>\n<p><p>\u5728Jupyter Notebook\u4e2d\uff0c\u60a8\u53ef\u4ee5\u5728\u5355\u5143\u683c\u4e2d\u8f93\u5165Python\u4ee3\u7801\uff0c\u5e76\u901a\u8fc7Shift+Enter\u952e\u8fd0\u884c\u8be5\u5355\u5143\u683c\u3002\u7ed3\u679c\u5c06\u663e\u793a\u5728\u5355\u5143\u683c\u4e0b\u65b9\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883<\/p>\n<\/p>\n<p><p>\u5728\u5f00\u53d1\u5927\u578b\u9879\u76ee\u6216\u591a\u4e2a\u9879\u76ee\u65f6\uff0c\u4f7f\u7528\u865a\u62df\u73af\u5883\u53ef\u4ee5\u5e2e\u52a9\u9694\u79bb\u9879\u76ee\u6240\u9700\u7684\u4f9d\u8d56\u5305\uff0c\u907f\u514d\u7248\u672c\u51b2\u7a81\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u76ee\u5f55\u4e0b\uff0c\u901a\u8fc7\u547d\u4ee4 <code>python -m venv myenv<\/code> \u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>myenv<\/code>\u7684\u865a\u62df\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u547d\u4ee4 <code>myenv\\Scripts\\activate<\/code> \u6fc0\u6d3b\u865a\u62df\u73af\u5883\u3002\u6fc0\u6d3b\u540e\uff0c\u60a8\u53ef\u4ee5\u5b89\u88c5\u548c\u7ba1\u7406\u8be5\u73af\u5883\u4e2d\u7684\u4f9d\u8d56\u5305\uff0c\u800c\u4e0d\u5f71\u54cd\u5168\u5c40Python\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5728\u865a\u62df\u73af\u5883\u4e2d\u8fd0\u884cPython<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u6fc0\u6d3b\u7684\u865a\u62df\u73af\u5883\u4e2d\uff0c\u60a8\u53ef\u4ee5\u50cf\u5e73\u5e38\u4e00\u6837\u8fd0\u884cPython\u811a\u672c\u6216\u4f7f\u7528Python\u4ea4\u4e92\u6a21\u5f0f\u3002\u6240\u6709\u7684\u64cd\u4f5c\u90fd\u53ea\u4f1a\u5f71\u54cd\u5f53\u524d\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e03\u3001\u4f7f\u7528Python\u5305\u7ba1\u7406\u5de5\u5177<\/p>\n<\/p>\n<p><p>Python\u7684\u5f3a\u5927\u4e4b\u5904\u5728\u4e8e\u5176\u4e30\u5bcc\u7684\u7b2c\u4e09\u65b9\u5e93\u548c\u5305\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528pip\u5de5\u5177\u6765\u5b89\u88c5\u548c\u7ba1\u7406\u8fd9\u4e9b\u5305\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5Python\u5305<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u547d\u4ee4 <code>pip install package_name<\/code> \u5b89\u88c5\u6240\u9700\u7684Python\u5305\u3002\u5b89\u88c5\u540e\uff0c\u60a8\u53ef\u4ee5\u5728Python\u4ee3\u7801\u4e2d\u901a\u8fc7 <code>import package_name<\/code> \u6765\u4f7f\u7528\u8be5\u5305\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u67e5\u770b\u5df2\u5b89\u88c5\u7684\u5305<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u547d\u4ee4 <code>pip list<\/code> \u67e5\u770b\u5f53\u524d\u73af\u5883\u4e2d\u5df2\u5b89\u88c5\u7684Python\u5305\u53ca\u5176\u7248\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u66f4\u65b0\u6216\u5378\u8f7d\u5305<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u547d\u4ee4 <code>pip install --upgrade package_name<\/code> \u66f4\u65b0\u5305\uff0c\u6216\u4f7f\u7528 <code>pip uninstall package_name<\/code> \u5378\u8f7d\u4e0d\u518d\u9700\u8981\u7684\u5305\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516b\u3001\u8c03\u8bd5\u548c\u6d4b\u8bd5Python\u4ee3\u7801<\/p>\n<\/p>\n<p><p>\u8c03\u8bd5\u548c\u6d4b\u8bd5\u662f\u8f6f\u4ef6\u5f00\u53d1\u7684\u91cd\u8981\u73af\u8282\uff0cPython\u63d0\u4f9b\u4e86\u591a\u79cd\u5de5\u5177\u548c\u65b9\u6cd5\u6765\u5e2e\u52a9\u5f00\u53d1\u8005\u8fdb\u884c\u8c03\u8bd5\u548c\u6d4b\u8bd5\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528print\u8bed\u53e5\u8c03\u8bd5<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u4ee3\u7801\u4e2d\u63d2\u5165 <code>print()<\/code> \u8bed\u53e5\u53ef\u4ee5\u5e2e\u52a9\u60a8\u67e5\u770b\u53d8\u91cf\u7684\u503c\u548c\u7a0b\u5e8f\u6267\u884c\u7684\u6d41\u7a0b\u3002\u8fd9\u662f\u6700\u7b80\u5355\u7684\u8c03\u8bd5\u65b9\u6cd5\uff0c\u4f46\u5bf9\u4e8e\u590d\u6742\u7684\u9879\u76ee\u53ef\u80fd\u4e0d\u591f\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528Python\u8c03\u8bd5\u5668\uff08pdb\uff09<\/strong><\/p>\n<\/p>\n<p><p>Python\u5185\u7f6e\u7684\u8c03\u8bd5\u5668\uff08pdb\uff09\u63d0\u4f9b\u4e86\u66f4\u4e3a\u5f3a\u5927\u7684\u8c03\u8bd5\u529f\u80fd\u3002\u901a\u8fc7\u5728\u4ee3\u7801\u4e2d\u63d2\u5165 <code>import pdb; pdb.set_trace()<\/code>\uff0c\u60a8\u53ef\u4ee5\u5728\u4ee3\u7801\u6267\u884c\u5230\u8be5\u5904\u65f6\u8fdb\u5165\u8c03\u8bd5\u6a21\u5f0f\uff0c\u9010\u6b65\u68c0\u67e5\u4ee3\u7801\u6267\u884c\u7684\u60c5\u51b5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u5199\u5355\u5143\u6d4b\u8bd5<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528Python\u7684 <code>unittest<\/code> \u6a21\u5757\u7f16\u5199\u6d4b\u8bd5\u7528\u4f8b\uff0c\u53ef\u4ee5\u81ea\u52a8\u5316\u6d4b\u8bd5\u4ee3\u7801\u529f\u80fd\uff0c\u786e\u4fdd\u4ee3\u7801\u5728\u4fee\u6539\u540e\u4ecd\u7136\u6b63\u786e\u5de5\u4f5c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e5d\u3001\u4f18\u5316\u548c\u63d0\u9ad8Python\u4ee3\u7801\u6027\u80fd<\/p>\n<\/p>\n<p><p>\u5728\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u65f6\uff0c\u6027\u80fd\u4f18\u5316\u4e5f\u662f\u4e00\u4e2a\u91cd\u8981\u7684\u8003\u8651\u56e0\u7d20\uff0c\u7279\u522b\u662f\u5728\u5904\u7406\u5927\u578b\u6570\u636e\u96c6\u6216\u8fdb\u884c\u590d\u6742\u8ba1\u7b97\u65f6\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f<\/strong><\/p>\n<\/p>\n<p><p>\u5217\u8868\u63a8\u5bfc\u5f0f\u53ef\u4ee5\u5728\u4e00\u884c\u4ee3\u7801\u4e2d\u751f\u6210\u5217\u8868\uff0c\u6bd4\u4f20\u7edf\u7684for\u5faa\u73af\u66f4\u4e3a\u7b80\u6d01\u548c\u9ad8\u6548\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9009\u62e9\u5408\u9002\u7684\u6570\u636e\u7ed3\u6784<\/strong><\/p>\n<\/p>\n<p><p>\u6839\u636e\u9700\u6c42\u9009\u62e9\u9002\u5f53\u7684\u6570\u636e\u7ed3\u6784\uff08\u5982\u5217\u8868\u3001\u96c6\u5408\u3001\u5b57\u5178\u7b49\uff09\uff0c\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u6548\u7387\u548c\u53ef\u8bfb\u6027\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528NumPy\u7b49\u79d1\u5b66\u8ba1\u7b97\u5e93<\/strong><\/p>\n<\/p>\n<p><p>NumPy\u7b49\u79d1\u5b66\u8ba1\u7b97\u5e93\u63d0\u4f9b\u4e86\u5bf9\u6570\u7ec4\u548c\u77e9\u9635\u7684\u9ad8\u6548\u64cd\u4f5c\uff0c\u5927\u5927\u63d0\u9ad8\u4e86\u8ba1\u7b97\u901f\u5ea6\uff0c\u9002\u5408\u7528\u4e8e\u6570\u636e\u5206\u6790\u548c\u79d1\u5b66\u8ba1\u7b97\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u5341\u3001\u6301\u7eed\u5b66\u4e60\u548c\u5b9e\u8df5<\/p>\n<\/p>\n<p><p>Python\u662f\u4e00\u95e8\u4e0d\u65ad\u53d1\u5c55\u7684\u8bed\u8a00\uff0c\u793e\u533a\u6d3b\u8dc3\uff0c\u8d44\u6e90\u4e30\u5bcc\u3002\u901a\u8fc7\u4e0d\u65ad\u5b66\u4e60\u548c\u5b9e\u8df5\uff0c\u60a8\u53ef\u4ee5\u66f4\u6df1\u5165\u5730\u638c\u63e1Python\u7684\u4f7f\u7528\u6280\u5de7\u548c\u6700\u4f73\u5b9e\u8df5\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u53c2\u4e0e\u5f00\u6e90\u9879\u76ee<\/strong><\/p>\n<\/p>\n<p><p>\u53c2\u4e0e\u5f00\u6e90\u9879\u76ee\u662f\u63d0\u9ad8\u7f16\u7a0b\u80fd\u529b\u548c\u79ef\u7d2f\u7ecf\u9a8c\u7684\u597d\u65b9\u6cd5\u3002\u60a8\u53ef\u4ee5\u5728GitHub\u7b49\u5e73\u53f0\u4e0a\u627e\u5230\u611f\u5174\u8da3\u7684\u9879\u76ee\uff0c\u8d21\u732e\u4ee3\u7801\u548c\u6587\u6863\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u53c2\u52a0Python\u793e\u533a\u6d3b\u52a8<\/strong><\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u53c2\u52a0Python\u4f1a\u8bae\u3001\u7814\u8ba8\u4f1a\u548c\u5728\u7ebf\u4ea4\u6d41\u5e73\u53f0\uff0c\u60a8\u53ef\u4ee5\u4e0e\u5176\u4ed6Python\u5f00\u53d1\u8005\u4ea4\u6d41\u7ecf\u9a8c\u3001\u5206\u4eab\u77e5\u8bc6\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9605\u8bfbPython\u6587\u6863\u548c\u4e66\u7c4d<\/strong><\/p>\n<\/p>\n<p><p>\u5b98\u65b9\u6587\u6863\u548c\u4e13\u4e1a\u4e66\u7c4d\u662f\u6df1\u5165\u5b66\u4e60Python\u7684\u826f\u597d\u8d44\u6e90\u3002\u901a\u8fc7\u7cfb\u7edf\u5730\u5b66\u4e60\uff0c\u60a8\u53ef\u4ee5\u66f4\u597d\u5730\u7406\u89e3Python\u7684\u7279\u6027\u548c\u5e94\u7528\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u5728Windows\u4e0a\u6709\u6548\u5730\u8fd0\u884c\u548c\u7ba1\u7406Python\u4ee3\u7801\u3002\u65e0\u8bba\u662f\u521d\u5b66\u8005\u8fd8\u662f\u7ecf\u9a8c\u4e30\u5bcc\u7684\u5f00\u53d1\u8005\uff0c\u638c\u63e1\u8fd9\u4e9b\u6280\u5de7\u90fd\u80fd\u5e2e\u52a9\u60a8\u66f4\u597d\u5730\u5229\u7528Python\u8fdb\u884c\u5f00\u53d1\u548c\u521b\u65b0\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5728Windows\u4e0a\u5b89\u88c5Python\u9700\u8981\u54ea\u4e9b\u6b65\u9aa4\uff1f<\/strong><br \/>\u8981\u5728Windows\u4e0a\u5b89\u88c5Python\uff0c\u60a8\u9700\u8981\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\uff0c\u4e0b\u8f7d\u9002\u5408\u60a8\u7cfb\u7edf\u7684\u5b89\u88c5\u5305\u3002\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\uff0c\u786e\u4fdd\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u6837\u53ef\u4ee5\u65b9\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u76f4\u63a5\u4f7f\u7528Python\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165<code>python --version<\/code>\u6765\u786e\u8ba4\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Windows\u4e0a\u4f7f\u7528\u547d\u4ee4\u884c\u8fd0\u884cPython\u811a\u672c\uff1f<\/strong><br \/>\u5728Windows\u4e0a\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u63d0\u793a\u7b26\u8fd0\u884cPython\u811a\u672c\u3002\u9996\u5148\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u5207\u6362\u5230\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u3002\u7136\u540e\u8f93\u5165<code>python script_name.py<\/code>\uff08\u5c06<code>script_name.py<\/code>\u66ff\u6362\u4e3a\u60a8\u7684\u811a\u672c\u6587\u4ef6\u540d\uff09\uff0c\u5373\u53ef\u8fd0\u884c\u8be5Python\u811a\u672c\u3002\u5982\u679c\u811a\u672c\u8f93\u51fa\u9519\u8bef\uff0c\u786e\u4fdd\u60a8\u7684\u4ee3\u7801\u65e0\u8bef\u5e76\u4e14Python\u73af\u5883\u914d\u7f6e\u6b63\u786e\u3002<\/p>\n<p><strong>\u5728Windows\u73af\u5883\u4e2d\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684IDE\u6216\u6587\u672c\u7f16\u8f91\u5668\u6765\u7f16\u5199Python\u4ee3\u7801\uff1f<\/strong><br \/>\u5728Windows\u73af\u5883\u4e2d\uff0c\u6709\u591a\u79cdIDE\u548c\u6587\u672c\u7f16\u8f91\u5668\u53ef\u4f9b\u9009\u62e9\u3002\u5e38\u89c1\u7684\u5305\u62ecPyCharm\u3001Visual Studio Code\u3001Jupyter Notebook\u548cSublime Text\u7b49\u3002\u9009\u62e9\u5408\u9002\u7684IDE\u53ef\u4ee5\u63d0\u5347\u60a8\u7684\u7f16\u7a0b\u6548\u7387\u3002\u4f8b\u5982\uff0cPyCharm\u9002\u5408\u5927\u578b\u9879\u76ee\u5f00\u53d1\uff0c\u800cVisual Studio Code\u8f7b\u91cf\u4e14\u6269\u5c55\u6027\u5f3a\u3002\u6839\u636e\u9879\u76ee\u9700\u6c42\u548c\u4e2a\u4eba\u559c\u597d\uff0c\u60a8\u53ef\u4ee5\u5c1d\u8bd5\u4e0d\u540c\u7684\u5de5\u5177\u6765\u627e\u5230\u6700\u9002\u5408\u81ea\u5df1\u7684\u7f16\u7a0b\u73af\u5883\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Windows\u4e0a\u8fd0\u884cPython\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u5f0f\uff1a\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u3001\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u3001Python [&hellip;]","protected":false},"author":3,"featured_media":953155,"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\/953148"}],"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=953148"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/953148\/revisions"}],"predecessor-version":[{"id":953158,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/953148\/revisions\/953158"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/953155"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=953148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=953148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=953148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}