{"id":1179680,"date":"2025-01-15T18:26:59","date_gmt":"2025-01-15T10:26:59","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1179680.html"},"modified":"2025-01-15T18:27:03","modified_gmt":"2025-01-15T10:27:03","slug":"%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85python%e5%bf%ab%e6%8d%b7%e6%96%b9%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1179680.html","title":{"rendered":"\u5982\u4f55\u5b89\u88c5python\u5feb\u6377\u65b9\u5f0f"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25114021\/619bba01-025f-4f94-b819-eb152e4730e1.webp\" alt=\"\u5982\u4f55\u5b89\u88c5python\u5feb\u6377\u65b9\u5f0f\" \/><\/p>\n<p><p> \u8981\u5728\u7cfb\u7edf\u4e2d\u5b89\u88c5Python\u5feb\u6377\u65b9\u5f0f\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b9e\u73b0\uff1a<strong>\u4e0b\u8f7d\u5e76\u5b89\u88c5Python\u3001\u6dfb\u52a0Python\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u3001\u521b\u5efa\u684c\u9762\u5feb\u6377\u65b9\u5f0f<\/strong>\u3002\u8fd9\u4e9b\u6b65\u9aa4\u53ef\u4ee5\u786e\u4fdd\u60a8\u5728\u9700\u8981\u65f6\u5feb\u901f\u8bbf\u95eePython\u89e3\u91ca\u5668\u6216Python\u811a\u672c\u3002\u4e0b\u9762\u6211\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u6267\u884c\u6bcf\u4e00\u6b65\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4e0b\u8f7d\u5e76\u5b89\u88c5Python<\/h3>\n<\/p>\n<ol>\n<li><strong>\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9<\/strong>\uff1a\u9996\u5148\uff0c\u6253\u5f00\u6d4f\u89c8\u5668\u5e76\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%E3%80%82\">https:\/\/www.python.org\/\uff09\u3002<\/a><\/li>\n<li><strong>\u4e0b\u8f7d\u9002\u5408\u7684Python\u7248\u672c<\/strong>\uff1a\u5728\u4e0b\u8f7d\u9875\u9762\u4e0a\uff0c\u9009\u62e9\u9002\u5408\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684Python\u7248\u672c\uff08Windows\u3001macOS\u6216Linux\uff09\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u9009\u62e9\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u5373\u53ef\u3002<\/li>\n<li><strong>\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f<\/strong>\uff1a\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3002\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u52a1\u5fc5\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u5c06\u81ea\u52a8\u5c06Python\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/li>\n<\/ol>\n<p><h3>\u4e8c\u3001\u6dfb\u52a0Python\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u60a8\u5728\u5b89\u88c5Python\u65f6\u672a\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u60a8\u53ef\u4ee5\u624b\u52a8\u5c06Python\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u6253\u5f00\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e<\/strong>\uff1a\u5728Windows\u4e0a\uff0c\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u201c\u6211\u7684\u7535\u8111\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\uff0c\u7136\u540e\u70b9\u51fb\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\uff0c\u518d\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u3002<\/li>\n<li><strong>\u7f16\u8f91Path\u53d8\u91cf<\/strong>\uff1a\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u4e2d\u627e\u5230Path\u53d8\u91cf\uff0c\u9009\u4e2d\u540e\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u3002<\/li>\n<li><strong>\u6dfb\u52a0Python\u8def\u5f84<\/strong>\uff1a\u70b9\u51fb\u201c\u65b0\u5efa\u201d\uff0c\u7136\u540e\u8f93\u5165Python\u7684\u5b89\u88c5\u8def\u5f84\uff08\u4f8b\u5982\uff1aC:\\Python39\\\u6216C:\\Users\\YourUsername\\AppData\\Local\\Programs\\Python\\Python39\\\uff09\uff0c\u70b9\u51fb\u786e\u5b9a\u4fdd\u5b58\u3002<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u521b\u5efa\u684c\u9762\u5feb\u6377\u65b9\u5f0f<\/h3>\n<\/p>\n<ol>\n<li><strong>\u5b9a\u4f4dPython\u53ef\u6267\u884c\u6587\u4ef6<\/strong>\uff1a\u627e\u5230Python\u7684\u5b89\u88c5\u76ee\u5f55\uff0c\u5b9a\u4f4d\u5230python.exe\u6587\u4ef6\u3002<\/li>\n<li><strong>\u521b\u5efa\u5feb\u6377\u65b9\u5f0f<\/strong>\uff1a\u53f3\u952e\u70b9\u51fbpython.exe\u6587\u4ef6\uff0c\u9009\u62e9\u201c\u521b\u5efa\u5feb\u6377\u65b9\u5f0f\u201d\u3002\u7136\u540e\uff0c\u5c06\u751f\u6210\u7684\u5feb\u6377\u65b9\u5f0f\u62d6\u52a8\u5230\u684c\u9762\u4e0a\u3002<\/li>\n<li><strong>\u4fee\u6539\u5feb\u6377\u65b9\u5f0f\u5c5e\u6027<\/strong>\uff1a\u53f3\u952e\u70b9\u51fb\u684c\u9762\u4e0a\u7684Python\u5feb\u6377\u65b9\u5f0f\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002\u5728\u201c\u5feb\u6377\u65b9\u5f0f\u201d\u9009\u9879\u5361\u4e2d\uff0c\u60a8\u53ef\u4ee5\u8bbe\u7f6e\u5feb\u6377\u65b9\u5f0f\u7684\u76ee\u6807\u8def\u5f84\u3001\u8d77\u59cb\u4f4d\u7f6e\u7b49\u3002<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u5feb\u6377\u65b9\u5f0f<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u60a8\u66f4\u559c\u6b22\u4f7f\u7528\u547d\u4ee4\u884c\uff0c\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u6279\u5904\u7406\u6587\u4ef6\u6765\u5feb\u901f\u542f\u52a8Python\u89e3\u91ca\u5668\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u521b\u5efa\u6279\u5904\u7406\u6587\u4ef6<\/strong>\uff1a\u5728\u684c\u9762\u4e0a\u53f3\u952e\u70b9\u51fb\uff0c\u9009\u62e9\u201c\u65b0\u5efa\u201d-&gt;\u201c\u6587\u672c\u6587\u6863\u201d\uff0c\u5c06\u6587\u4ef6\u547d\u540d\u4e3astart_python.bat\uff08\u786e\u4fdd\u6587\u4ef6\u6269\u5c55\u540d\u4e3a.bat\uff09\u3002<\/li>\n<li><strong>\u7f16\u8f91\u6279\u5904\u7406\u6587\u4ef6<\/strong>\uff1a\u53f3\u952e\u70b9\u51fbstart_python.bat\u6587\u4ef6\uff0c\u9009\u62e9\u201c\u7f16\u8f91\u201d\uff0c\u5728\u6587\u4ef6\u4e2d\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a\n<pre><code class=\"language-batch\">@echo off<\/p>\n<p>C:\\Python39\\python.exe<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p>\u5c06\u8def\u5f84\u66ff\u6362\u4e3a\u60a8\u5b9e\u9645\u7684Python\u5b89\u88c5\u8def\u5f84\u3002\u4fdd\u5b58\u5e76\u5173\u95ed\u6587\u4ef6\u3002<\/li>\n<\/p>\n<li><strong>\u8fd0\u884c\u6279\u5904\u7406\u6587\u4ef6<\/strong>\uff1a\u53cc\u51fbstart_python.bat\u6587\u4ef6\u5373\u53ef\u5feb\u901f\u542f\u52a8Python\u89e3\u91ca\u5668\u3002<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u65b9\u4fbf\u5730\u5728\u7cfb\u7edf\u4e2d\u521b\u5efaPython\u5feb\u6377\u65b9\u5f0f\uff0c\u65e0\u8bba\u662f\u5728\u684c\u9762\u4e0a\u8fd8\u662f\u901a\u8fc7\u547d\u4ee4\u884c\uff0c\u90fd\u80fd\u591f\u5feb\u901f\u8bbf\u95eePython\u89e3\u91ca\u5668\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u5728macOS\u4e0a\u8bbe\u7f6e\u5feb\u6377\u65b9\u5f0f<\/h3>\n<\/p>\n<p><p>\u5728macOS\u4e0a\uff0c\u60a8\u4e5f\u53ef\u4ee5\u901a\u8fc7\u7c7b\u4f3c\u7684\u65b9\u6cd5\u8bbe\u7f6ePython\u5feb\u6377\u65b9\u5f0f\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u5b89\u88c5Python<\/strong>\uff1a\u6253\u5f00\u7ec8\u7aef\uff0c\u4f7f\u7528Homebrew\u5b89\u88c5Python\uff1a\n<pre><code class=\"language-shell\">brew install python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li><strong>\u521b\u5efa\u522b\u540d<\/strong>\uff1a\u6253\u5f00\u7ec8\u7aef\uff0c\u7f16\u8f91\u60a8\u7684shell\u914d\u7f6e\u6587\u4ef6\uff08\u4f8b\u5982\uff1a<del>\/.bash_profile\u6216<\/del>\/.zshrc\uff09\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a\n<pre><code class=\"language-shell\">alias python=&#39;\/usr\/local\/bin\/python3&#39;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p>\u4fdd\u5b58\u6587\u4ef6\u5e76\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\uff1a<\/p>\n<pre><code class=\"language-shell\">source ~\/.bash_profile<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li><strong>\u521b\u5efa\u5e94\u7528\u5feb\u6377\u65b9\u5f0f<\/strong>\uff1a\u60a8\u53ef\u4ee5\u4f7f\u7528Automator\u521b\u5efa\u4e00\u4e2a\u5e94\u7528\u6765\u542f\u52a8Python\uff1a\n<ul>\n<li>\u6253\u5f00Automator\uff0c\u9009\u62e9\u201c\u5e94\u7528\u7a0b\u5e8f\u201d\u3002<\/li>\n<li>\u9009\u62e9\u201c\u8fd0\u884cShell\u811a\u672c\u201d\u3002<\/li>\n<li>\u5728\u811a\u672c\u4e2d\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a\n<pre><code class=\"language-shell\">\/usr\/local\/bin\/python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u4fdd\u5b58\u5e94\u7528\u5e76\u5c06\u5176\u62d6\u52a8\u5230Dock\u4e0a\uff0c\u60a8\u5c31\u53ef\u4ee5\u901a\u8fc7\u70b9\u51fb\u56fe\u6807\u5feb\u901f\u542f\u52a8Python\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u5728macOS\u4e0a\u65b9\u4fbf\u5730\u521b\u5efaPython\u5feb\u6377\u65b9\u5f0f\uff0c\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u5728Linux\u4e0a\u8bbe\u7f6e\u5feb\u6377\u65b9\u5f0f<\/h3>\n<\/p>\n<p><p>\u5728Linux\u4e0a\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\u6216\u4f7f\u7528\u684c\u9762\u73af\u5883\u63d0\u4f9b\u7684\u529f\u80fd\u6765\u8bbe\u7f6ePython\u5feb\u6377\u65b9\u5f0f\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u5b89\u88c5Python<\/strong>\uff1a\u6253\u5f00\u7ec8\u7aef\uff0c\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5Python\uff08\u4ee5Ubuntu\u4e3a\u4f8b\uff09\uff1a\n<pre><code class=\"language-shell\">sudo apt update<\/p>\n<p>sudo apt install python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li><strong>\u521b\u5efa\u7b26\u53f7\u94fe\u63a5<\/strong>\uff1a\u60a8\u53ef\u4ee5\u5728\/usr\/local\/bin\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u7b26\u53f7\u94fe\u63a5\u6765\u5feb\u901f\u8bbf\u95eePython\uff1a\n<pre><code class=\"language-shell\">sudo ln -s \/usr\/bin\/python3 \/usr\/local\/bin\/python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li><strong>\u521b\u5efa\u684c\u9762\u5feb\u6377\u65b9\u5f0f<\/strong>\uff1a\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fGNOME\u6216\u5176\u4ed6\u684c\u9762\u73af\u5883\uff0c\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a.desktop\u6587\u4ef6\u6765\u8bbe\u7f6e\u5feb\u6377\u65b9\u5f0f\uff1a\n<ul>\n<li>\u6253\u5f00\u6587\u672c\u7f16\u8f91\u5668\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684.desktop\u6587\u4ef6\uff08\u4f8b\u5982\uff1a~\/Desktop\/python.desktop\uff09\u3002<\/li>\n<li>\u5728\u6587\u4ef6\u4e2d\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a\n<pre><code class=\"language-ini\">[Desktop Entry]<\/p>\n<p>Version=1.0<\/p>\n<p>Name=Python<\/p>\n<p>Comment=Run Python Interpreter<\/p>\n<p>Exec=\/usr\/bin\/python3<\/p>\n<p>Icon=utilities-terminal<\/p>\n<p>Terminal=true<\/p>\n<p>Type=Application<\/p>\n<p>Categories=Development;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u4fdd\u5b58\u6587\u4ef6\u5e76\u8d4b\u4e88\u6267\u884c\u6743\u9650\uff1a\n<pre><code class=\"language-shell\">chmod +x ~\/Desktop\/python.desktop<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u60a8\u73b0\u5728\u53ef\u4ee5\u901a\u8fc7\u70b9\u51fb\u684c\u9762\u4e0a\u7684\u56fe\u6807\u5feb\u901f\u542f\u52a8Python\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u5728\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8bbe\u7f6ePython\u5feb\u6377\u65b9\u5f0f\uff0c\u60a8\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u548c\u4e60\u60ef\u5feb\u901f\u8bbf\u95eePython\u89e3\u91ca\u5668\u6216Python\u811a\u672c\uff0c\u4ece\u800c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u5de5\u4f5c\u4fbf\u5229\u6027\u3002\u65e0\u8bba\u662f\u5728Windows\u3001macOS\u8fd8\u662fLinux\u4e0a\uff0c\u8fd9\u4e9b\u65b9\u6cd5\u90fd\u80fd\u5e2e\u52a9\u60a8\u7b80\u5316\u64cd\u4f5c\uff0c\u8282\u7701\u65f6\u95f4\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u5728IDE\u4e2d\u8bbe\u7f6e\u5feb\u6377\u65b9\u5f0f<\/h3>\n<\/p>\n<p><p>\u9664\u4e86\u5728\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u8bbe\u7f6ePython\u5feb\u6377\u65b9\u5f0f\uff0c\u60a8\u8fd8\u53ef\u4ee5\u5728\u5e38\u7528\u7684\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u4e2d\u8bbe\u7f6e\u5feb\u6377\u65b9\u5f0f\uff0c\u4ee5\u4fbf\u5feb\u901f\u542f\u52a8Python\u89e3\u91ca\u5668\u6216\u8fd0\u884cPython\u811a\u672c\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>PyCharm<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00PyCharm\uff0c\u521b\u5efa\u6216\u6253\u5f00\u4e00\u4e2aPython\u9879\u76ee\u3002<\/li>\n<li>\u5728\u83dc\u5355\u680f\u4e2d\u9009\u62e9\u201cFile\u201d -&gt; \u201cSettings\u201d\u3002<\/li>\n<li>\u5728\u201cKeymap\u201d\u9009\u9879\u4e2d\uff0c\u60a8\u53ef\u4ee5\u627e\u5230\u5e76\u8bbe\u7f6e\u5feb\u6377\u952e\uff0c\u4f8b\u5982\u8fd0\u884c\u5f53\u524d\u6587\u4ef6\u3001\u6253\u5f00Python\u63a7\u5236\u53f0\u7b49\u3002<\/li>\n<li>\u5728\u201cTools\u201d -&gt; \u201cPython Console\u201d\u4e2d\uff0c\u60a8\u53ef\u4ee5\u8bbe\u7f6ePython\u63a7\u5236\u53f0\u7684\u542f\u52a8\u914d\u7f6e\uff0c\u786e\u4fdd\u5176\u80fd\u591f\u5feb\u901f\u542f\u52a8\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>VS Code<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00VS Code\uff0c\u5b89\u88c5Python\u6269\u5c55\u3002<\/li>\n<li>\u5728\u201cFile\u201d -&gt; \u201cPreferences\u201d -&gt; \u201cKeyboard Shortcuts\u201d\u4e2d\uff0c\u60a8\u53ef\u4ee5\u67e5\u627e\u5e76\u8bbe\u7f6e\u5feb\u6377\u952e\uff0c\u4f8b\u5982\u8fd0\u884cPython\u811a\u672c\u3001\u542f\u52a8\u7ec8\u7aef\u7b49\u3002<\/li>\n<li>\u6309\u4e0bCtrl+Shift+P\uff0c\u8f93\u5165\u201cPython: Start REPL\u201d\u53ef\u4ee5\u5feb\u901f\u542f\u52a8Python\u89e3\u91ca\u5668\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Jupyter Notebook<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5b89\u88c5Jupyter Notebook\uff1a\n<pre><code class=\"language-shell\">pip install notebook<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8Jupyter Notebook\uff1a\n<pre><code class=\"language-shell\">jupyter notebook<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u60a8\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00Jupyter Notebook\uff0c\u5e76\u4f7f\u7528\u5feb\u6377\u952e\u6765\u63d0\u9ad8\u6548\u7387\uff0c\u4f8b\u5982Shift+Enter\u8fd0\u884c\u5f53\u524d\u5355\u5143\u683c\u3001Ctrl+Enter\u8fd0\u884c\u5f53\u524d\u5355\u5143\u683c\u5e76\u4fdd\u6301\u7126\u70b9\u7b49\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u5728IDE\u4e2d\u8bbe\u7f6e\u5feb\u6377\u65b9\u5f0f\uff0c\u60a8\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u5de5\u4f5c\u4e60\u60ef\u548c\u9700\u6c42\u8fdb\u884c\u4e2a\u6027\u5316\u914d\u7f6e\uff0c\u4ece\u800c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u64cd\u4f5c\u4fbf\u6377\u6027\u3002<\/p>\n<\/p>\n<p><h3>\u516b\u3001\u5728\u6587\u672c\u7f16\u8f91\u5668\u4e2d\u8bbe\u7f6e\u5feb\u6377\u65b9\u5f0f<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u60a8\u66f4\u559c\u6b22\u4f7f\u7528\u8f7b\u91cf\u7ea7\u7684\u6587\u672c\u7f16\u8f91\u5668\u8fdb\u884c\u5f00\u53d1\uff0c\u60a8\u4e5f\u53ef\u4ee5\u5728\u8fd9\u4e9b\u7f16\u8f91\u5668\u4e2d\u8bbe\u7f6ePython\u5feb\u6377\u65b9\u5f0f\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Sublime Text<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5b89\u88c5Package Control\uff1a\n<ul>\n<li>\u6309\u4e0bCtrl+`\u6253\u5f00\u63a7\u5236\u53f0\uff0c\u8f93\u5165\u4ee5\u4e0b\u4ee3\u7801\u5e76\u56de\u8f66\uff1a\n<pre><code class=\"language-python\">import urllib.request,os,hashlib; h = &#39;9e1f3d9e6e44a1b3d2b28e3d2b7f9e0a&#39;; pf = &#39;Package Control.sublime-package&#39;; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen(&#39;http:\/\/packagecontrol.io\/&#39;+pf.replace(&#39; &#39;,&#39;%20&#39;)).read(); dh = hashlib.sha256(by).hexdigest(); if dh != h: r<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>se Exception(&#39;Error validating download (got %s instead of %s)&#39; % (dh, h)); open(os.path.join(ipp, pf), &#39;wb&#39; ).write(by)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\u5b89\u88c5Anaconda\u63d2\u4ef6\uff1a\n<ul>\n<li>\u6309\u4e0bCtrl+Shift+P\uff0c\u8f93\u5165\u201cInstall Package\u201d\uff0c\u9009\u62e9\u201cPackage Control: Install Package\u201d\u3002<\/li>\n<li>\u8f93\u5165\u201cAnaconda\u201d\u5e76\u5b89\u88c5\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u914d\u7f6e\u5feb\u6377\u952e\uff1a\n<ul>\n<li>\u6253\u5f00\u201cPreferences\u201d -&gt; \u201cKey Bindings\u201d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a\n<pre><code class=\"language-json\">{<\/p>\n<p>    &quot;keys&quot;: [&quot;ctrl+alt+r&quot;],<\/p>\n<p>    &quot;command&quot;: &quot;anaconda_run&quot;<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Atom<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5b89\u88c5Python\u63d2\u4ef6\uff1a\n<ul>\n<li>\u6253\u5f00\u201cSettings\u201d -&gt; \u201cInstall\u201d\uff0c\u641c\u7d22\u5e76\u5b89\u88c5\u201cide-python\u201d\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u914d\u7f6e\u5feb\u6377\u952e\uff1a\n<ul>\n<li>\u6253\u5f00\u201cSettings\u201d -&gt; \u201cKeybindings\u201d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a\n<pre><code class=\"language-json\">{<\/p>\n<p>    &quot;keystrokes&quot;: &quot;ctrl-alt-r&quot;,<\/p>\n<p>    &quot;command&quot;: &quot;ide-python:run-script&quot;<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u5728\u6587\u672c\u7f16\u8f91\u5668\u4e2d\u8bbe\u7f6e\u5feb\u6377\u65b9\u5f0f\uff0c\u60a8\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u548c\u4e60\u60ef\u5feb\u901f\u8fd0\u884cPython\u811a\u672c\u6216\u542f\u52a8Python\u89e3\u91ca\u5668\uff0c\u4ece\u800c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u64cd\u4f5c\u4fbf\u6377\u6027\u3002<\/p>\n<\/p>\n<p><h3>\u4e5d\u3001\u5728\u6d4f\u89c8\u5668\u4e2d\u8bbe\u7f6e\u5feb\u6377\u65b9\u5f0f<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u60a8\u559c\u6b22\u5728\u6d4f\u89c8\u5668\u4e2d\u8fdb\u884c\u5f00\u53d1\uff0c\u60a8\u4e5f\u53ef\u4ee5\u901a\u8fc7\u4e00\u4e9b\u5728\u7ebf\u5de5\u5177\u548c\u6269\u5c55\u6765\u8bbe\u7f6ePython\u5feb\u6377\u65b9\u5f0f\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528Google Colab<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00Google Colab\uff08<a href=\"https:\/\/colab.research.google.com\/%EF%BC%89%E3%80%82\">https:\/\/colab.research.google.com\/\uff09\u3002<\/a><\/li>\n<li>\u767b\u5f55\u60a8\u7684Google\u8d26\u53f7\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Python\u7b14\u8bb0\u672c\u3002<\/li>\n<li>\u60a8\u53ef\u4ee5\u4f7f\u7528\u5feb\u6377\u952e\u6765\u63d0\u9ad8\u6548\u7387\uff0c\u4f8b\u5982Shift+Enter\u8fd0\u884c\u5f53\u524d\u5355\u5143\u683c\u3001Ctrl+Enter\u8fd0\u884c\u5f53\u524d\u5355\u5143\u683c\u5e76\u4fdd\u6301\u7126\u70b9\u7b49\u3002<\/li>\n<li>\u60a8\u8fd8\u53ef\u4ee5\u5c06Google Colab\u6dfb\u52a0\u5230\u6d4f\u89c8\u5668\u7684\u4e66\u7b7e\u680f\uff0c\u4ee5\u4fbf\u5feb\u901f\u8bbf\u95ee\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528Repl.it<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00Repl.it\uff08<a href=\"https:\/\/repl.it\/%EF%BC%89%E3%80%82\">https:\/\/repl.it\/\uff09\u3002<\/a><\/li>\n<li>\u767b\u5f55\u60a8\u7684\u8d26\u53f7\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Python\u9879\u76ee\u3002<\/li>\n<li>\u60a8\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u4e2d\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\uff0c\u5e76\u4f7f\u7528\u5feb\u6377\u952e\u6765\u63d0\u9ad8\u6548\u7387\uff0c\u4f8b\u5982Ctrl+Enter\u8fd0\u884c\u4ee3\u7801\u3001Ctrl+S\u4fdd\u5b58\u6587\u4ef6\u7b49\u3002<\/li>\n<li>\u60a8\u8fd8\u53ef\u4ee5\u5c06Repl.it\u6dfb\u52a0\u5230\u6d4f\u89c8\u5668\u7684\u4e66\u7b7e\u680f\uff0c\u4ee5\u4fbf\u5feb\u901f\u8bbf\u95ee\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u5728\u6d4f\u89c8\u5668\u4e2d\u8bbe\u7f6e\u5feb\u6377\u65b9\u5f0f\uff0c\u60a8\u53ef\u4ee5\u5728\u4efb\u4f55\u8bbe\u5907\u4e0a\u5feb\u901f\u8bbf\u95ee\u548c\u8fd0\u884cPython\u4ee3\u7801\uff0c\u4ece\u800c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u64cd\u4f5c\u4fbf\u6377\u6027\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5Python\u5feb\u6377\u65b9\u5f0f\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u64cd\u4f5c\u4fbf\u6377\u6027\u3002\u65e0\u8bba\u662f\u5728\u64cd\u4f5c\u7cfb\u7edf\u3001IDE\u3001\u6587\u672c\u7f16\u8f91\u5668\u8fd8\u662f\u6d4f\u89c8\u5668\u4e2d\uff0c\u60a8\u90fd\u53ef\u4ee5\u901a\u8fc7\u5408\u7406\u7684\u914d\u7f6e\u548c\u8bbe\u7f6e\u6765\u5b9e\u73b0\u8fd9\u4e00\u76ee\u6807\u3002\u901a\u8fc7\u672c\u6587\u4ecb\u7ecd\u7684\u6b65\u9aa4\u548c\u65b9\u6cd5\uff0c\u60a8\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u548c\u4e60\u60ef\u5feb\u901f\u8bbf\u95ee\u548c\u8fd0\u884cPython\u89e3\u91ca\u5668\u6216Python\u811a\u672c\uff0c\u4ece\u800c\u66f4\u9ad8\u6548\u5730\u8fdb\u884c\u5f00\u53d1\u548c\u5de5\u4f5c\u3002\u5e0c\u671b\u8fd9\u4e9b\u5185\u5bb9\u5bf9\u60a8\u6709\u6240\u5e2e\u52a9\uff0c\u795d\u60a8\u5728Python\u5f00\u53d1\u4e2d\u53d6\u5f97\u66f4\u5927\u7684\u8fdb\u6b65\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728\u684c\u9762\u4e0a\u521b\u5efaPython\u5feb\u6377\u65b9\u5f0f\uff1f<\/strong><br \/>\u8981\u5728\u684c\u9762\u4e0a\u521b\u5efaPython\u7684\u5feb\u6377\u65b9\u5f0f\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a\u9996\u5148\uff0c\u627e\u5230Python\u7684\u5b89\u88c5\u76ee\u5f55\uff0c\u901a\u5e38\u4f4d\u4e8eC:\\PythonXX\uff08XX\u4e3a\u7248\u672c\u53f7\uff09\u3002\u7136\u540e\uff0c\u627e\u5230python.exe\u6587\u4ef6\uff0c\u53f3\u952e\u70b9\u51fb\u8be5\u6587\u4ef6\uff0c\u9009\u62e9\u201c\u53d1\u9001\u5230\u201d\u9009\u9879\u4e2d\u7684\u201c\u684c\u9762(\u521b\u5efa\u5feb\u6377\u65b9\u5f0f)\u201d\u3002\u8fd9\u6837\uff0c\u4f60\u5c31\u53ef\u4ee5\u5728\u684c\u9762\u4e0a\u5feb\u901f\u8bbf\u95eePython\u4e86\u3002<\/p>\n<p><strong>\u5728Windows\u4e2d\uff0cPython\u5feb\u6377\u65b9\u5f0f\u7684\u5e38\u89c1\u95ee\u9898\u6709\u54ea\u4e9b\uff1f<\/strong><br \/>\u7528\u6237\u5728\u521b\u5efaPython\u5feb\u6377\u65b9\u5f0f\u65f6\uff0c\u5e38\u5e38\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\u3002\u4f8b\u5982\uff0c\u5feb\u6377\u65b9\u5f0f\u6307\u5411\u7684\u6587\u4ef6\u8def\u5f84\u4e0d\u6b63\u786e\u6216\u8005Python\u672a\u6b63\u786e\u5b89\u88c5\u3002\u786e\u4fdd\u5728\u521b\u5efa\u5feb\u6377\u65b9\u5f0f\u524d\uff0cPython\u5df2\u6210\u529f\u5b89\u88c5\u5e76\u4e14\u73af\u5883\u53d8\u91cf\u5df2\u6b63\u786e\u8bbe\u7f6e\uff0c\u8fd9\u6837\u624d\u80fd\u907f\u514d\u65e0\u6cd5\u542f\u52a8\u7684\u95ee\u9898\u3002<\/p>\n<p><strong>\u5982\u4f55\u4e3aPython\u5feb\u6377\u65b9\u5f0f\u8bbe\u7f6e\u81ea\u5b9a\u4e49\u56fe\u6807\uff1f<\/strong><br \/>\u5982\u679c\u60f3\u8981\u4e3aPython\u7684\u5feb\u6377\u65b9\u5f0f\u8bbe\u7f6e\u4e00\u4e2a\u81ea\u5b9a\u4e49\u56fe\u6807\uff0c\u53ef\u4ee5\u53f3\u952e\u70b9\u51fb\u521b\u5efa\u7684\u5feb\u6377\u65b9\u5f0f\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u66f4\u6539\u56fe\u6807\u201d\u6309\u94ae\uff0c\u7136\u540e\u9009\u62e9\u4f60\u60f3\u8981\u4f7f\u7528\u7684\u56fe\u6807\u6587\u4ef6\u3002\u5b8c\u6210\u540e\uff0c\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u4fdd\u5b58\u66f4\u6539\uff0c\u8fd9\u6837\u4f60\u7684\u5feb\u6377\u65b9\u5f0f\u5c31\u4f1a\u663e\u793a\u65b0\u7684\u56fe\u6807\uff0c\u65b9\u4fbf\u8bc6\u522b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u5728\u7cfb\u7edf\u4e2d\u5b89\u88c5Python\u5feb\u6377\u65b9\u5f0f\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b9e\u73b0\uff1a\u4e0b\u8f7d\u5e76\u5b89\u88c5Python\u3001\u6dfb\u52a0Python\u5230\u7cfb\u7edf\u73af\u5883\u53d8 [&hellip;]","protected":false},"author":3,"featured_media":1179687,"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\/1179680"}],"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=1179680"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1179680\/revisions"}],"predecessor-version":[{"id":1179688,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1179680\/revisions\/1179688"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1179687"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1179680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1179680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1179680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}