{"id":1010055,"date":"2024-12-27T11:17:32","date_gmt":"2024-12-27T03:17:32","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1010055.html"},"modified":"2024-12-27T11:17:35","modified_gmt":"2024-12-27T03:17:35","slug":"python%e5%a6%82%e4%bd%95%e6%9f%a5%e6%89%be%e8%a7%a3%e9%87%8a%e5%99%a8","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1010055.html","title":{"rendered":"Python\u5982\u4f55\u67e5\u627e\u89e3\u91ca\u5668"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25084740\/430456be-76e9-440a-ae57-2b42955023df.webp\" alt=\"Python\u5982\u4f55\u67e5\u627e\u89e3\u91ca\u5668\" \/><\/p>\n<p><p> <strong>Python\u67e5\u627e\u89e3\u91ca\u5668\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u3001\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u3001\u865a\u62df\u73af\u5883\u548c\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u7684\u8bbe\u7f6e\u3002<\/strong> \u5176\u4e2d\uff0c\u6700\u5e38\u7528\u7684\u65b9\u6cd5\u662f\u901a\u8fc7\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u5982<code>which<\/code>\u6216<code>where<\/code>\u547d\u4ee4\u6765\u5b9a\u4f4dPython\u89e3\u91ca\u5668\u7684\u4f4d\u7f6e\u3002\u4e86\u89e3\u8fd9\u4e9b\u65b9\u6cd5\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u5728\u4e0d\u540c\u7684\u5f00\u53d1\u73af\u5883\u4e2d\u5feb\u901f\u67e5\u627e\u548c\u914d\u7f6ePython\u89e3\u91ca\u5668\uff0c\u786e\u4fdd\u4ee3\u7801\u5728\u6b63\u786e\u7684\u73af\u5883\u4e0b\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>which<\/code>\u547d\u4ee4\u662f\u67e5\u627ePython\u89e3\u91ca\u5668\u7684\u4e00\u79cd\u5e38\u89c1\u65b9\u6cd5\u3002\u8be5\u547d\u4ee4\u7528\u4e8e\u5728Unix\u548cLinux\u7cfb\u7edf\u4e2d\u67e5\u627e\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\u3002\u5047\u8bbe\u4f60\u5728\u4e00\u4e2aUnix\u6216Linux\u7cfb\u7edf\u4e2d\uff0c\u4f60\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>which python<\/code>\u6216<code>which python3<\/code>\u6765\u67e5\u627e\u9ed8\u8ba4\u7684Python\u89e3\u91ca\u5668\u4f4d\u7f6e\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4f60\u4f7f\u7528\u7684\u662f\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684\u7248\u672c\uff0c\u800c\u4e0d\u662f\u5176\u4ed6\u8def\u5f84\u4e0b\u7684\u7248\u672c\u3002<\/p>\n<\/p>\n<hr>\n<p><p>\u4e00\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u67e5\u627e\u89e3\u91ca\u5668<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528<code>which<\/code>\u547d\u4ee4<\/strong><\/p>\n<\/p>\n<p><p>\u5728Unix\u6216Linux\u7cfb\u7edf\u4e2d\uff0c<code>which<\/code>\u547d\u4ee4\u662f\u4e00\u79cd\u6709\u6548\u7684\u5de5\u5177\uff0c\u7528\u4e8e\u67e5\u627e\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\u3002\u901a\u8fc7\u5728\u7ec8\u7aef\u8f93\u5165<code>which python<\/code>\u6216<code>which python3<\/code>\uff0c\u4f60\u53ef\u4ee5\u5feb\u901f\u627e\u5230\u7cfb\u7edf\u4e2dPython\u89e3\u91ca\u5668\u7684\u4f4d\u7f6e\u3002\u8fd9\u5bf9\u4e8e\u786e\u4fdd\u4f60\u5728\u6b63\u786e\u7684\u73af\u5883\u4e2d\u8fd0\u884cPython\u4ee3\u7801\u975e\u5e38\u6709\u7528\uff0c\u5c24\u5176\u662f\u5728\u7cfb\u7edf\u4e2d\u5b89\u88c5\u4e86\u591a\u4e2aPython\u7248\u672c\u7684\u60c5\u51b5\u4e0b\u3002<\/p>\n<\/p>\n<p><p>\u9664\u4e86<code>which<\/code>\u547d\u4ee4\uff0c\u4f60\u8fd8\u53ef\u4ee5\u4f7f\u7528<code>whereis<\/code>\u547d\u4ee4\uff0c\u5b83\u4e0d\u4ec5\u4f1a\u663e\u793aPython\u89e3\u91ca\u5668\u7684\u8def\u5f84\uff0c\u8fd8\u4f1a\u5217\u51fa\u76f8\u5173\u7684\u624b\u518c\u548c\u6e90\u4ee3\u7801\u6587\u4ef6\u3002\u8fd9\u5bf9\u4e8e\u9700\u8981\u6df1\u5165\u4e86\u89e3Python\u5b89\u88c5\u7ec6\u8282\u7684\u5f00\u53d1\u8005\u6765\u8bf4\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u5de5\u5177\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528<code>where<\/code>\u547d\u4ee4<\/strong><\/p>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c<code>where<\/code>\u547d\u4ee4\u4e0e<code>which<\/code>\u547d\u4ee4\u529f\u80fd\u76f8\u4f3c\u3002\u901a\u8fc7\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165<code>where python<\/code>\uff0c\u4f60\u53ef\u4ee5\u5f97\u5230Python\u89e3\u91ca\u5668\u7684\u8def\u5f84\u3002Windows\u53ef\u80fd\u4f1a\u8fd4\u56de\u591a\u4e2a\u8def\u5f84\uff0c\u7279\u522b\u662f\u5728\u5b89\u88c5\u4e86\u591a\u4e2aPython\u7248\u672c\u6216\u4f7f\u7528\u4e86\u5de5\u5177\u5982Anaconda\u7684\u60c5\u51b5\u4e0b\u3002<\/p>\n<\/p>\n<p><p>\u5728Windows\u4e2d\uff0cPython\u89e3\u91ca\u5668\u7684\u8def\u5f84\u901a\u5e38\u4f1a\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684<code>PATH<\/code>\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u8fd9\u4f7f\u5f97\u67e5\u627e\u548c\u8fd0\u884cPython\u89e3\u91ca\u5668\u53d8\u5f97\u66f4\u52a0\u65b9\u4fbf\u3002\u786e\u4fdd\u5728\u5b89\u88c5Python\u65f6\u9009\u62e9\u5c06\u5176\u6dfb\u52a0\u5230<code>PATH<\/code>\uff0c\u4ee5\u4fbf\u4e8e\u540e\u7eed\u7684\u67e5\u627e\u548c\u4f7f\u7528\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u914d\u7f6e<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u8bbe\u7f6e<code>PATH<\/code>\u73af\u5883\u53d8\u91cf<\/strong><\/p>\n<\/p>\n<p><p>\u73af\u5883\u53d8\u91cf<code>PATH<\/code>\u662f\u4e00\u4e2a\u5b58\u50a8\u7cfb\u7edf\u4e2d\u53ef\u6267\u884c\u6587\u4ef6\u8def\u5f84\u7684\u53d8\u91cf\u3002\u901a\u8fc7\u5c06Python\u89e3\u91ca\u5668\u7684\u8def\u5f84\u6dfb\u52a0\u5230<code>PATH<\/code>\u4e2d\uff0c\u4f60\u53ef\u4ee5\u5728\u4efb\u4f55\u76ee\u5f55\u4e0b\u76f4\u63a5\u8c03\u7528Python\u89e3\u91ca\u5668\u3002\u8fd9\u5728Windows\u548cUnix\/Linux\u7cfb\u7edf\u4e2d\u90fd\u9002\u7528\u3002<\/p>\n<\/p>\n<p><p>\u5728Windows\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u4e2d\u7684\u201c\u73af\u5883\u53d8\u91cf\u201d\u8bbe\u7f6e\u6765\u4fee\u6539<code>PATH<\/code>\u3002\u5728Unix\/Linux\u7cfb\u7edf\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u7f16\u8f91shell\u914d\u7f6e\u6587\u4ef6\uff08\u5982<code>.bashrc<\/code>\u6216<code>.bash_profile<\/code>\uff09\u6765\u6dfb\u52a0Python\u8def\u5f84\u3002\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4ec5\u9002\u7528\u4e8ePython\uff0c\u4e5f\u53ef\u4ee5\u7528\u4e8e\u5176\u4ed6\u9700\u8981\u5168\u5c40\u8bbf\u95ee\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528<code>PYTHONPATH<\/code>\u73af\u5883\u53d8\u91cf<\/strong><\/p>\n<\/p>\n<p><p><code>PYTHONPATH<\/code>\u662f\u53e6\u4e00\u4e2a\u91cd\u8981\u7684\u73af\u5883\u53d8\u91cf\uff0c\u5b83\u51b3\u5b9a\u4e86Python\u89e3\u91ca\u5668\u5728\u5bfc\u5165\u6a21\u5757\u65f6\u641c\u7d22\u7684\u76ee\u5f55\u3002\u901a\u8fc7\u8bbe\u7f6e<code>PYTHONPATH<\/code>\uff0c\u4f60\u53ef\u4ee5\u6307\u5b9a\u989d\u5916\u7684\u6a21\u5757\u641c\u7d22\u8def\u5f84\uff0c\u8fd9\u5bf9\u4e8e\u9700\u8981\u4f7f\u7528\u81ea\u5b9a\u4e49\u6a21\u5757\u6216\u5e93\u7684\u9879\u76ee\u6765\u8bf4\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<p><p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c<code>PYTHONPATH<\/code>\u7684\u8bbe\u7f6e\u4f1a\u5f71\u54cdPython\u89e3\u91ca\u5668\u7684\u6a21\u5757\u641c\u7d22\u8def\u5f84\uff0c\u56e0\u6b64\u5728\u4fee\u6539\u8fd9\u4e2a\u53d8\u91cf\u65f6\u8981\u5c0f\u5fc3\uff0c\u786e\u4fdd\u4e0d\u4f1a\u5f71\u54cd\u5230\u7cfb\u7edf\u7684\u5176\u4ed6Python\u9879\u76ee\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u548c\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<p><p>\u865a\u62df\u73af\u5883\uff08Virtual Environment\uff09\u662fPython\u5f00\u53d1\u4e2d\u975e\u5e38\u6709\u7528\u7684\u5de5\u5177\u3002\u5b83\u5141\u8bb8\u4f60\u4e3a\u6bcf\u4e2a\u9879\u76ee\u521b\u5efa\u4e00\u4e2a\u72ec\u7acb\u7684Python\u73af\u5883\uff0c\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u4e0d\u540c\u9879\u76ee\u4e4b\u95f4\u7684\u4f9d\u8d56\u51b2\u7a81\u3002\u5728\u865a\u62df\u73af\u5883\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u7279\u5b9a\u7248\u672c\u7684Python\u89e3\u91ca\u5668\u548c\u5e93\uff0c\u800c\u4e0d\u5f71\u54cd\u7cfb\u7edf\u7684\u5168\u5c40Python\u73af\u5883\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7<code>venv<\/code>\u6a21\u5757\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u521b\u5efa\u865a\u62df\u73af\u5883\u3002\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c<code>python -m venv myenv<\/code>\u5373\u53ef\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>myenv<\/code>\u7684\u865a\u62df\u73af\u5883\u3002\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u547d\u4ee4\u884c\u4f1a\u81ea\u52a8\u4f7f\u7528\u8be5\u73af\u5883\u4e2d\u7684Python\u89e3\u91ca\u5668\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7ba1\u7406\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<p><p>\u7ba1\u7406\u865a\u62df\u73af\u5883\u662f\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u91cd\u8981\u7684\u4e00\u73af\u3002\u4f60\u9700\u8981\u5b9a\u671f\u66f4\u65b0\u73af\u5883\u4e2d\u7684\u5e93\uff0c\u786e\u4fdd\u9879\u76ee\u4f9d\u8d56\u7684\u7248\u672c\u662f\u6700\u65b0\u548c\u7a33\u5b9a\u7684\u3002\u4f7f\u7528\u5de5\u5177\u5982<code>pip<\/code>\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5b89\u88c5\u3001\u66f4\u65b0\u548c\u7ba1\u7406\u865a\u62df\u73af\u5883\u4e2d\u7684\u5e93\u3002<\/p>\n<\/p>\n<p><p>\u5bf9\u4e8e\u591a\u4e2a\u9879\u76ee\u7684\u5f00\u53d1\u8005\u6765\u8bf4\uff0c\u4f7f\u7528\u865a\u62df\u73af\u5883\u7ba1\u7406\u5de5\u5177\u5982<code>virtualenvwrapper<\/code>\u53ef\u4ee5\u7b80\u5316\u865a\u62df\u73af\u5883\u7684\u521b\u5efa\u548c\u7ba1\u7406\u8fc7\u7a0b\u3002\u8fd9\u4e9b\u5de5\u5177\u63d0\u4f9b\u4e86\u66f4\u4e30\u5bcc\u7684\u547d\u4ee4\u548c\u529f\u80fd\uff0c\u4f7f\u5f97\u865a\u62df\u73af\u5883\u7684\u4f7f\u7528\u66f4\u52a0\u9ad8\u6548\u548c\u4fbf\u6377\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u5728IDE\u4e2d\u914d\u7f6ePython\u89e3\u91ca\u5668<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u9009\u62e9\u89e3\u91ca\u5668<\/strong><\/p>\n<\/p>\n<p><p>\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u901a\u5e38\u63d0\u4f9b\u4e86\u9009\u62e9\u548c\u914d\u7f6ePython\u89e3\u91ca\u5668\u7684\u529f\u80fd\u3002\u4f8b\u5982\uff0cPyCharm\u548cVSCode\u90fd\u5141\u8bb8\u4f60\u4e3a\u6bcf\u4e2a\u9879\u76ee\u9009\u62e9\u7279\u5b9a\u7684Python\u89e3\u91ca\u5668\u3002\u901a\u8fc7\u5728IDE\u4e2d\u8bbe\u7f6e\u89e3\u91ca\u5668\uff0c\u4f60\u53ef\u4ee5\u786e\u4fdd\u4ee3\u7801\u5728\u6b63\u786e\u7684\u73af\u5883\u4e2d\u8fd0\u884c\uff0c\u5e76\u5229\u7528IDE\u7684\u8c03\u8bd5\u548c\u81ea\u52a8\u8865\u5168\u7b49\u9ad8\u7ea7\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><p>\u5728PyCharm\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u201c\u9879\u76ee\u8bbe\u7f6e\u201d\u4e2d\u7684\u201cPython\u89e3\u91ca\u5668\u201d\u9009\u9879\u6765\u9009\u62e9\u548c\u914d\u7f6e\u89e3\u91ca\u5668\u3002VSCode\u5219\u901a\u8fc7\u63d2\u4ef6\u548c\u914d\u7f6e\u6587\u4ef6\u6765\u7ba1\u7406\u89e3\u91ca\u5668\u8bbe\u7f6e\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u7684\u7075\u6d3b\u6027\u4f7f\u5f97IDE\u6210\u4e3a\u5f00\u53d1\u8005\u7ba1\u7406Python\u73af\u5883\u7684\u91cd\u8981\u5de5\u5177\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7ba1\u7406\u9879\u76ee\u4f9d\u8d56<\/strong><\/p>\n<\/p>\n<p><p>\u5728IDE\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u7684\u5305\u7ba1\u7406\u5de5\u5177\u6765\u5b89\u88c5\u548c\u66f4\u65b0\u9879\u76ee\u4f9d\u8d56\u3002\u8fd9\u4f7f\u5f97\u7ba1\u7406\u9879\u76ee\u6240\u9700\u7684\u5e93\u53d8\u5f97\u66f4\u52a0\u7b80\u5355\u548c\u9ad8\u6548\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u56fe\u5f62\u754c\u9762\u67e5\u770b\u5df2\u5b89\u88c5\u7684\u5e93\u3001\u641c\u7d22\u65b0\u5e93\uff0c\u5e76\u5feb\u901f\u8fdb\u884c\u5b89\u88c5\u6216\u66f4\u65b0\u3002<\/p>\n<\/p>\n<p><p>\u5bf9\u4e8e\u4f7f\u7528PyCharm\u7684\u5f00\u53d1\u8005\u6765\u8bf4\uff0c\u5185\u7f6e\u7684\u5305\u7ba1\u7406\u5668\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\uff0c\u5305\u62ec\u67e5\u770b\u5e93\u7684\u8be6\u7ec6\u4fe1\u606f\u3001\u7248\u672c\u5386\u53f2\u548c\u4f9d\u8d56\u5173\u7cfb\u7b49\u3002\u8fd9\u4e9b\u529f\u80fd\u53ef\u4ee5\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7ba1\u7406\u9879\u76ee\u7684\u4f9d\u8d56\uff0c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u4f7f\u7528\u7248\u672c\u7ba1\u7406\u5de5\u5177<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Pyenv<\/strong><\/p>\n<\/p>\n<p><p>Pyenv\u662f\u4e00\u4e2a\u7528\u4e8e\u7ba1\u7406\u591a\u4e2aPython\u7248\u672c\u7684\u5de5\u5177\u3002\u5b83\u5141\u8bb8\u4f60\u5728\u540c\u4e00\u4e2a\u7cfb\u7edf\u4e2d\u5b89\u88c5\u548c\u5207\u6362\u4e0d\u540c\u7248\u672c\u7684Python\u89e3\u91ca\u5668\uff0c\u8fd9\u5bf9\u4e8e\u9700\u8981\u6d4b\u8bd5\u4e0d\u540cPython\u7248\u672c\u517c\u5bb9\u6027\u7684\u5f00\u53d1\u8005\u975e\u5e38\u6709\u7528\u3002\u901a\u8fc7\u7b80\u5355\u7684\u547d\u4ee4\uff0c\u4f60\u53ef\u4ee5\u5b89\u88c5\u3001\u5378\u8f7d\u548c\u8bbe\u7f6e\u5168\u5c40\u6216\u672c\u5730\u7684Python\u7248\u672c\u3002<\/p>\n<\/p>\n<p><p>Pyenv\u7684\u53e6\u4e00\u4e2a\u4f18\u70b9\u662f\uff0c\u5b83\u53ef\u4ee5\u4e0e\u865a\u62df\u73af\u5883\u5de5\u5177\u7ed3\u5408\u4f7f\u7528\uff0c\u63d0\u4f9b\u66f4\u7075\u6d3b\u7684Python\u73af\u5883\u7ba1\u7406\u65b9\u6848\u3002\u8fd9\u4f7f\u5f97\u5728\u590d\u6742\u9879\u76ee\u4e2d\u7ba1\u7406Python\u7248\u672c\u548c\u4f9d\u8d56\u53d8\u5f97\u66f4\u52a0\u7b80\u5355\u548c\u9ad8\u6548\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Anaconda<\/strong><\/p>\n<\/p>\n<p><p>Anaconda\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u6570\u636e\u79d1\u5b66\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u5e73\u53f0\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5f3a\u5927\u7684\u5305\u7ba1\u7406\u5668\u548c\u73af\u5883\u7ba1\u7406\u5de5\u5177\u3002\u901a\u8fc7Anaconda\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u521b\u5efa\u548c\u7ba1\u7406\u865a\u62df\u73af\u5883\uff0c\u5e76\u5b89\u88c5\u4f17\u591a\u79d1\u5b66\u8ba1\u7b97\u548c\u6570\u636e\u5206\u6790\u5e93\u3002<\/p>\n<\/p>\n<p><p>Anaconda\u7684\u4f18\u52bf\u5728\u4e8e\uff0c\u5b83\u9884\u88c5\u4e86\u8bb8\u591a\u5e38\u7528\u7684\u79d1\u5b66\u8ba1\u7b97\u5e93\uff0c\u5982NumPy\u3001Pandas\u548cMatplotlib\uff0c\u8fd9\u4f7f\u5f97\u5b83\u6210\u4e3a\u6570\u636e\u79d1\u5b66\u5bb6\u7684\u9996\u9009\u5e73\u53f0\u3002\u901a\u8fc7Anaconda\uff0c\u4f60\u53ef\u4ee5\u5728\u4e00\u4e2a\u7edf\u4e00\u7684\u5e73\u53f0\u4e0a\u7ba1\u7406Python\u89e3\u91ca\u5668\u548c\u9879\u76ee\u4f9d\u8d56\uff0c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>Python\u89e3\u91ca\u5668\u7684\u67e5\u627e\u548c\u914d\u7f6e\u662f\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u4e00\u4e2a\u91cd\u8981\u7684\u6b65\u9aa4\u3002\u901a\u8fc7\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u3001\u73af\u5883\u53d8\u91cf\u3001\u865a\u62df\u73af\u5883\u3001IDE\u548c\u7248\u672c\u7ba1\u7406\u5de5\u5177\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u5728\u4e0d\u540c\u7684\u73af\u5883\u4e2d\u7075\u6d3b\u7ba1\u7406Python\u89e3\u91ca\u5668\u548c\u9879\u76ee\u4f9d\u8d56\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\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\uff0c\u786e\u4fdd\u9879\u76ee\u5728\u6b63\u786e\u7684\u73af\u5883\u4e2d\u8fd0\u884c\u3002\u901a\u8fc7\u5408\u7406\u914d\u7f6e\u548c\u7ba1\u7406Python\u89e3\u91ca\u5668\uff0c\u4f60\u53ef\u4ee5\u66f4\u4e13\u6ce8\u4e8e\u4ee3\u7801\u7684\u7f16\u5199\u548c\u4f18\u5316\uff0c\u800c\u65e0\u9700\u62c5\u5fc3\u73af\u5883\u95ee\u9898\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u68c0\u67e5\u6211\u7684\u7cfb\u7edf\u4e0a\u662f\u5426\u5b89\u88c5\u4e86Python\u89e3\u91ca\u5668\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u4e2d\u8f93\u5165<code>python --version<\/code>\u6216<code>python3 --version<\/code>\u6765\u68c0\u67e5Python\u89e3\u91ca\u5668\u662f\u5426\u5df2\u5b89\u88c5\u3002\u5982\u679cPython\u5df2\u5b89\u88c5\uff0c\u7cfb\u7edf\u5c06\u8fd4\u56de\u5f53\u524d\u5b89\u88c5\u7684\u7248\u672c\u53f7\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7248\u672c\u3002<\/p>\n<p><strong>\u6211\u8be5\u5982\u4f55\u627e\u5230Python\u89e3\u91ca\u5668\u7684\u5b89\u88c5\u8def\u5f84\uff1f<\/strong><br \/>\u5728\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u4e2d\u8f93\u5165<code>which python<\/code>\uff08\u5bf9\u4e8eLinux\u548cmacOS\uff09\u6216<code>where python<\/code>\uff08\u5bf9\u4e8eWindows\uff09\u53ef\u4ee5\u5e2e\u52a9\u60a8\u627e\u5230Python\u89e3\u91ca\u5668\u7684\u5177\u4f53\u5b89\u88c5\u8def\u5f84\u3002\u8fd9\u4e9b\u547d\u4ee4\u5c06\u663e\u793aPython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5b8c\u6574\u8def\u5f84\uff0c\u65b9\u4fbf\u60a8\u8fdb\u884c\u540e\u7eed\u914d\u7f6e\u6216\u4f7f\u7528\u3002<\/p>\n<p><strong>\u662f\u5426\u53ef\u4ee5\u5728\u540c\u4e00\u7cfb\u7edf\u4e0a\u5b89\u88c5\u591a\u4e2a\u7248\u672c\u7684Python\u89e3\u91ca\u5668\uff1f<\/strong><br \/>\u5b8c\u5168\u53ef\u4ee5\u3002\u5728\u4e00\u53f0\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5\u591a\u4e2aPython\u7248\u672c\u662f\u5e38\u89c1\u7684\u505a\u6cd5\uff0c\u5c24\u5176\u662f\u5f53\u60a8\u9700\u8981\u5728\u4e0d\u540c\u9879\u76ee\u4e2d\u4f7f\u7528\u4e0d\u540c\u7248\u672c\u65f6\u3002\u4f7f\u7528\u7248\u672c\u7ba1\u7406\u5de5\u5177\u5982<code>pyenv<\/code>\u53ef\u4ee5\u65b9\u4fbf\u5730\u7ba1\u7406\u548c\u5207\u6362\u4e0d\u540c\u7684Python\u7248\u672c\uff0c\u4f7f\u5f97\u5f00\u53d1\u5de5\u4f5c\u66f4\u52a0\u7075\u6d3b\u9ad8\u6548\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u67e5\u627e\u89e3\u91ca\u5668\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u3001\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u3001\u865a\u62df\u73af\u5883\u548c\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u7684\u8bbe\u7f6e\u3002 [&hellip;]","protected":false},"author":3,"featured_media":1010063,"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\/1010055"}],"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=1010055"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1010055\/revisions"}],"predecessor-version":[{"id":1010067,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1010055\/revisions\/1010067"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1010063"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1010055"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1010055"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1010055"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}