{"id":1167424,"date":"2025-01-15T15:44:35","date_gmt":"2025-01-15T07:44:35","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1167424.html"},"modified":"2025-01-15T15:44:38","modified_gmt":"2025-01-15T07:44:38","slug":"%e5%a6%82%e4%bd%95%e6%89%be%e5%88%b0python%e7%9a%84%e5%ae%89%e8%a3%85%e8%b7%af%e5%be%84","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1167424.html","title":{"rendered":"\u5982\u4f55\u627e\u5230python\u7684\u5b89\u88c5\u8def\u5f84"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25211346\/2e4e2266-d00c-4557-8798-c49224d21ffd.webp\" alt=\"\u5982\u4f55\u627e\u5230python\u7684\u5b89\u88c5\u8def\u5f84\" \/><\/p>\n<p><p> <strong>\u5982\u4f55\u627e\u5230Python\u7684\u5b89\u88c5\u8def\u5f84\uff1f<\/strong><\/p>\n<\/p>\n<p><p><strong>\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u3001\u67e5\u770b\u73af\u5883\u53d8\u91cf\u3001\u4f7f\u7528Python\u5185\u90e8\u51fd\u6570\u3001\u901a\u8fc7Python\u5b89\u88c5\u7ba1\u7406\u5668\u3001\u67e5\u770b\u64cd\u4f5c\u7cfb\u7edf\u9ed8\u8ba4\u8def\u5f84<\/strong>\u3002\u5176\u4e2d\uff0c<strong>\u4f7f\u7528Python\u5185\u90e8\u51fd\u6570<\/strong>\u662f\u4e00\u79cd\u7b80\u5355\u4e14\u9ad8\u6548\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u901a\u8fc7Python\u5185\u7f6e\u7684sys\u6a21\u5757\u6765\u83b7\u53d6Python\u7684\u5b89\u88c5\u8def\u5f84\u3002\u8be6\u7ec6\u63cf\u8ff0\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><p>\u8981\u627e\u5230Python\u7684\u5b89\u88c5\u8def\u5f84\uff0c\u53ef\u4ee5\u5728Python\u7684\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u6216\u811a\u672c\u4e2d\u4f7f\u7528sys\u6a21\u5757\u3002\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u5e76\u4e14\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884cPython\u547d\u4ee4\u3002\u7136\u540e\uff0c\u6253\u5f00Python\u89e3\u91ca\u5668\u5e76\u8f93\u5165\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import sys<\/p>\n<p>print(sys.executable)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd0\u884c\u8fd9\u6bb5\u4ee3\u7801\u540e\uff0c\u89e3\u91ca\u5668\u5c06\u4f1a\u8f93\u51faPython\u89e3\u91ca\u5668\u6240\u5728\u7684\u7edd\u5bf9\u8def\u5f84\uff0c\u8fd9\u5c31\u662fPython\u7684\u5b89\u88c5\u8def\u5f84\u3002\u4f8b\u5982\uff0c\u5728Windows\u7cfb\u7edf\u4e0a\uff0c\u8f93\u51fa\u53ef\u80fd\u662f\uff1a<\/p>\n<\/p>\n<p><pre><code>C:\\Python39\\python.exe<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u8868\u660ePython\u5b89\u88c5\u5728C\u76d8\u7684Python39\u6587\u4ef6\u5939\u4e2d\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e00\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177<\/h3>\n<\/p>\n<p><p>\u547d\u4ee4\u884c\u5de5\u5177\u662f\u67e5\u627ePython\u5b89\u88c5\u8def\u5f84\u7684\u4e00\u79cd\u76f4\u63a5\u4e14\u65b9\u4fbf\u7684\u65b9\u6cd5\u3002\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u7684\u547d\u4ee4\u884c\u5de5\u5177\u548c\u547d\u4ee4\u7a0d\u6709\u4e0d\u540c\uff0c\u4ee5\u4e0b\u662f\u5177\u4f53\u64cd\u4f5c\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><h4>1. Windows\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\uff08cmd\uff09\u6216PowerShell\u6765\u67e5\u627ePython\u7684\u5b89\u88c5\u8def\u5f84\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216PowerShell\u3002<\/li>\n<li>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5e76\u6309\u4e0b\u56de\u8f66\u952e\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-cmd\">where python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8be5\u547d\u4ee4\u5c06\u663e\u793aPython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\uff0c\u901a\u5e38\u4f1a\u5217\u51fa\u6240\u6709\u627e\u5230\u7684Python\u89e3\u91ca\u5668\u8def\u5f84\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code>C:\\Users\\YourUsername\\AppData\\Local\\Programs\\Python\\Python39\\python.exe<\/p>\n<p>C:\\Python39\\python.exe<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. macOS\u548cLinux\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728macOS\u548cLinux\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u7ec8\u7aef\uff08Terminal\uff09\u6765\u67e5\u627ePython\u7684\u5b89\u88c5\u8def\u5f84\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u7ec8\u7aef\u3002<\/li>\n<li>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5e76\u6309\u4e0b\u56de\u8f66\u952e\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">which python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8be5\u547d\u4ee4\u5c06\u663e\u793aPython3\u89e3\u91ca\u5668\u7684\u8def\u5f84\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code>\/usr\/local\/bin\/python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662fPython2\uff0c\u53ef\u4ee5\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">which python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u67e5\u770b\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u73af\u5883\u53d8\u91cf\u662f\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7528\u4e8e\u5b58\u50a8\u7cfb\u7edf\u548c\u7528\u6237\u914d\u7f6e\u4fe1\u606f\u7684\u53d8\u91cf\u3002Python\u7684\u5b89\u88c5\u8def\u5f84\u901a\u5e38\u4f1a\u88ab\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u56e0\u6b64\u67e5\u770b\u73af\u5883\u53d8\u91cf\u4e5f\u662f\u67e5\u627ePython\u5b89\u88c5\u8def\u5f84\u7684\u4e00\u79cd\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h4>1. Windows\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u67e5\u770b\u73af\u5883\u53d8\u91cf\u4e2d\u7684Python\u8def\u5f84\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u201c\u6211\u7684\u7535\u8111\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u5bf9\u8bdd\u6846\u4e2d\uff0c\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\u3002<\/li>\n<li>\u5728\u201c\u73af\u5883\u53d8\u91cf\u201d\u5bf9\u8bdd\u6846\u4e2d\uff0c\u67e5\u770b\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u6216\u201c\u7528\u6237\u53d8\u91cf\u201d\u4e2d\u7684\u201cPath\u201d\u53d8\u91cf\u3002<\/li>\n<\/ol>\n<p><p>\u201cPath\u201d\u53d8\u91cf\u4e2d\u5305\u542b\u4e86\u8bb8\u591a\u8def\u5f84\uff0c\u6bcf\u4e2a\u8def\u5f84\u4e4b\u95f4\u7528\u5206\u53f7\uff08;\uff09\u5206\u9694\uff0c\u67e5\u627e\u5176\u4e2d\u5305\u542b\u201cpython\u201d\u6216\u201cPythonXX\u201d\uff08XX\u8868\u793aPython\u7248\u672c\u53f7\uff09\u7684\u8def\u5f84\u5373\u53ef\u3002<\/p>\n<\/p>\n<p><h4>2. macOS\u548cLinux\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728macOS\u548cLinux\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770bshell\u914d\u7f6e\u6587\u4ef6\uff08\u4f8b\u5982<del>\/.bashrc\u3001<\/del>\/.zshrc\u3001~\/.profile\u7b49\uff09\u6765\u67e5\u627e\u73af\u5883\u53d8\u91cf\u4e2d\u7684Python\u8def\u5f84\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u7ec8\u7aef\u3002<\/li>\n<li>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bshell\u914d\u7f6e\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">cat ~\/.bashrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">cat ~\/.zshrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li>\u67e5\u627e\u914d\u7f6e\u6587\u4ef6\u4e2d\u5305\u542b\u201cPYTHONPATH\u201d\u6216\u201cPATH\u201d\u7684\u884c\u3002<\/li>\n<\/ol>\n<p><p>\u8fd9\u4e9b\u884c\u4e2d\u5305\u542b\u7684\u8def\u5f84\u4e2d\uff0c\u5982\u679c\u6709\u4e0ePython\u76f8\u5173\u7684\u8def\u5f84\uff0c\u5373\u4e3aPython\u7684\u5b89\u88c5\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528Python\u5185\u90e8\u51fd\u6570<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528Python\u5185\u90e8\u51fd\u6570\u662f\u67e5\u627ePython\u5b89\u88c5\u8def\u5f84\u7684\u4e00\u79cd\u7b80\u4fbf\u65b9\u6cd5\uff0c\u53ef\u4ee5\u901a\u8fc7Python\u5185\u7f6e\u7684sys\u6a21\u5757\u6765\u83b7\u53d6\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00Python\u89e3\u91ca\u5668\u6216\u521b\u5efa\u4e00\u4e2aPython\u811a\u672c\u3002<\/li>\n<li>\u8f93\u5165\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-python\">import sys<\/p>\n<p>print(sys.executable)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li>\u8fd0\u884c\u4ee3\u7801\uff0c\u8f93\u51fa\u7684\u8def\u5f84\u5373\u4e3aPython\u7684\u5b89\u88c5\u8def\u5f84\u3002\u4f8b\u5982\uff1a<\/li>\n<\/ol>\n<p><pre><code>\/usr\/local\/bin\/python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u901a\u8fc7Python\u5b89\u88c5\u7ba1\u7406\u5668<\/h3>\n<\/p>\n<p><p>Python\u5b89\u88c5\u7ba1\u7406\u5668\uff08\u5982pyenv\u3001Conda\u7b49\uff09\u662f\u7ba1\u7406\u591a\u4e2aPython\u7248\u672c\u548c\u73af\u5883\u7684\u5de5\u5177\u3002\u901a\u8fc7\u8fd9\u4e9b\u5de5\u5177\uff0c\u4e5f\u53ef\u4ee5\u65b9\u4fbf\u5730\u67e5\u627ePython\u7684\u5b89\u88c5\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><h4>1. \u4f7f\u7528pyenv<\/h4>\n<\/p>\n<p><p>pyenv\u662f\u4e00\u4e2a\u7528\u4e8e\u7ba1\u7406\u591a\u4e2aPython\u7248\u672c\u7684\u5de5\u5177\u3002\u4ee5\u4e0b\u662f\u67e5\u627ePython\u5b89\u88c5\u8def\u5f84\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5b89\u88c5\u5e76\u914d\u7f6epyenv\u3002<\/li>\n<li>\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u5df2\u5b89\u88c5\u7684Python\u7248\u672c\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">pyenv versions<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li>\u9009\u62e9\u4e00\u4e2aPython\u7248\u672c\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u5176\u5b89\u88c5\u8def\u5f84\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">pyenv which python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8be5\u547d\u4ee4\u5c06\u8f93\u51fa\u8be5\u7248\u672cPython\u89e3\u91ca\u5668\u7684\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><h4>2. \u4f7f\u7528Conda<\/h4>\n<\/p>\n<p><p>Conda\u662f\u4e00\u4e2a\u7528\u4e8e\u7ba1\u7406Python\u73af\u5883\u548c\u5305\u7684\u5de5\u5177\uff0c\u7279\u522b\u5e38\u7528\u4e8e\u6570\u636e\u79d1\u5b66\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u3002\u4ee5\u4e0b\u662f\u67e5\u627ePython\u5b89\u88c5\u8def\u5f84\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5b89\u88c5\u5e76\u914d\u7f6eConda\u3002<\/li>\n<li>\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u5df2\u6fc0\u6d3b\u7684Conda\u73af\u5883\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">conda info --envs<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li>\u6fc0\u6d3b\u4e00\u4e2aConda\u73af\u5883\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bPython\u89e3\u91ca\u5668\u7684\u8def\u5f84\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">which python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8be5\u547d\u4ee4\u5c06\u8f93\u51fa\u8be5\u73af\u5883\u4e2dPython\u89e3\u91ca\u5668\u7684\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u67e5\u770b\u64cd\u4f5c\u7cfb\u7edf\u9ed8\u8ba4\u8def\u5f84<\/h3>\n<\/p>\n<p><p>\u5728\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u4e2d\uff0cPython\u7684\u9ed8\u8ba4\u5b89\u88c5\u8def\u5f84\u53ef\u80fd\u6709\u6240\u4e0d\u540c\uff0c\u53ef\u4ee5\u6839\u636e\u64cd\u4f5c\u7cfb\u7edf\u7684\u9ed8\u8ba4\u8def\u5f84\u6765\u67e5\u627ePython\u7684\u5b89\u88c5\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><h4>1. Windows\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0cPython\u7684\u9ed8\u8ba4\u5b89\u88c5\u8def\u5f84\u901a\u5e38\u4f4d\u4e8e\u4ee5\u4e0b\u4f4d\u7f6e\uff1a<\/p>\n<\/p>\n<p><pre><code>C:\\PythonXX\\<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216<\/p>\n<\/p>\n<p><pre><code>C:\\Users\\YourUsername\\AppData\\Local\\Programs\\Python\\PythonXX\\<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5176\u4e2d\uff0cXX\u8868\u793aPython\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<p><h4>2. macOS\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728macOS\u7cfb\u7edf\u4e2d\uff0cPython\u7684\u9ed8\u8ba4\u5b89\u88c5\u8def\u5f84\u901a\u5e38\u4f4d\u4e8e\u4ee5\u4e0b\u4f4d\u7f6e\uff1a<\/p>\n<\/p>\n<p><pre><code>\/usr\/local\/bin\/python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216<\/p>\n<\/p>\n<p><pre><code>\/Library\/Frameworks\/Python.framework\/Versions\/3.X\/bin\/python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5176\u4e2d\uff0c3.X\u8868\u793aPython\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<p><h4>3. Linux\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Linux\u7cfb\u7edf\u4e2d\uff0cPython\u7684\u9ed8\u8ba4\u5b89\u88c5\u8def\u5f84\u901a\u5e38\u4f4d\u4e8e\u4ee5\u4e0b\u4f4d\u7f6e\uff1a<\/p>\n<\/p>\n<p><pre><code>\/usr\/bin\/python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216<\/p>\n<\/p>\n<p><pre><code>\/usr\/local\/bin\/python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7efc\u4e0a\u6240\u8ff0\uff0c\u901a\u8fc7\u4ee5\u4e0a\u51e0\u79cd\u65b9\u6cd5\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u67e5\u627ePython\u7684\u5b89\u88c5\u8def\u5f84\u3002\u4e0d\u540c\u7684\u65b9\u6cd5\u9002\u7528\u4e8e\u4e0d\u540c\u7684\u573a\u666f\u548c\u9700\u6c42\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u60c5\u51b5\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u3002\u65e0\u8bba\u662f\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u3001\u67e5\u770b\u73af\u5883\u53d8\u91cf\u3001\u4f7f\u7528Python\u5185\u90e8\u51fd\u6570\u3001\u901a\u8fc7Python\u5b89\u88c5\u7ba1\u7406\u5668\uff0c\u8fd8\u662f\u67e5\u770b\u64cd\u4f5c\u7cfb\u7edf\u9ed8\u8ba4\u8def\u5f84\uff0c\u90fd\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5feb\u901f\u627e\u5230Python\u7684\u5b89\u88c5\u8def\u5f84\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u786e\u8ba4\u6211\u7684Python\u7248\u672c\u53ca\u5176\u5b89\u88c5\u8def\u5f84\uff1f<\/strong><br \/>\u8981\u786e\u8ba4Python\u7684\u7248\u672c\u548c\u5b89\u88c5\u8def\u5f84\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165<code>python --version<\/code>\u6216<code>python3 --version<\/code>\u6765\u67e5\u770b\u5f53\u524d\u5b89\u88c5\u7684\u7248\u672c\u3002\u63a5\u7740\uff0c\u8f93\u5165<code>which python<\/code>\u6216<code>which python3<\/code>\uff08\u5728Windows\u4e0a\u4f7f\u7528<code>where python<\/code>\uff09\u53ef\u4ee5\u663e\u793aPython\u7684\u5b89\u88c5\u8def\u5f84\u3002\u8fd9\u4e9b\u547d\u4ee4\u5c06\u5e2e\u52a9\u4f60\u5feb\u901f\u627e\u5230\u6240\u9700\u7684\u4fe1\u606f\u3002<\/p>\n<p><strong>\u5982\u679c\u6211\u5728\u7cfb\u7edf\u4e0a\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\u7684Python\uff0c\u5982\u4f55\u533a\u5206\u5b83\u4eec\u7684\u5b89\u88c5\u8def\u5f84\uff1f<\/strong><br \/>\u5728\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\u7684Python\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528<code>py -0<\/code>\u547d\u4ee4\uff08Windows\uff09\u6216<code>ls \/usr\/bin\/python*<\/code>\uff08Linux\u548cMac\uff09\u6765\u5217\u51fa\u6240\u6709\u5b89\u88c5\u7684Python\u7248\u672c\u53ca\u5176\u8def\u5f84\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u80fd\u591f\u6e05\u6670\u5730\u8bc6\u522b\u6bcf\u4e2a\u7248\u672c\u7684\u4f4d\u7f6e\uff0c\u5e76\u6839\u636e\u9700\u8981\u8fdb\u884c\u5207\u6362\u3002<\/p>\n<p><strong>\u5728Windows\u4e0a\uff0c\u5982\u4f55\u901a\u8fc7\u56fe\u5f62\u754c\u9762\u627e\u5230Python\u7684\u5b89\u88c5\u8def\u5f84\uff1f<\/strong><br \/>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u63a7\u5236\u9762\u677f\u627e\u5230Python\u7684\u5b89\u88c5\u8def\u5f84\u3002\u8fdb\u5165\u201c\u63a7\u5236\u9762\u677f\u201d\uff0c\u70b9\u51fb\u201c\u7a0b\u5e8f\u548c\u529f\u80fd\u201d\uff0c\u5728\u5217\u8868\u4e2d\u627e\u5230Python\uff0c\u53f3\u952e\u70b9\u51fb\u5e76\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\uff0c\u60a8\u5c06\u770b\u5230Python\u7684\u5b89\u88c5\u8def\u5f84\u3002\u6b64\u5916\uff0c\u60a8\u4e5f\u53ef\u4ee5\u5728\u5f00\u59cb\u83dc\u5355\u4e2d\u641c\u7d22\u201cPython\u201d\uff0c\u53f3\u952e\u70b9\u51fb\u56fe\u6807\u9009\u62e9\u201c\u6253\u5f00\u6587\u4ef6\u4f4d\u7f6e\u201d\u6765\u76f4\u63a5\u8bbf\u95ee\u5b89\u88c5\u76ee\u5f55\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5982\u4f55\u627e\u5230Python\u7684\u5b89\u88c5\u8def\u5f84\uff1f \u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u3001\u67e5\u770b\u73af\u5883\u53d8\u91cf\u3001\u4f7f\u7528Python\u5185\u90e8\u51fd\u6570\u3001\u901a\u8fc7Python\u5b89\u88c5 [&hellip;]","protected":false},"author":3,"featured_media":1167431,"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\/1167424"}],"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=1167424"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1167424\/revisions"}],"predecessor-version":[{"id":1167433,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1167424\/revisions\/1167433"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1167431"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1167424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1167424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1167424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}