{"id":925616,"date":"2024-12-26T15:34:14","date_gmt":"2024-12-26T07:34:14","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/925616.html"},"modified":"2024-12-26T15:34:15","modified_gmt":"2024-12-26T07:34:15","slug":"%e5%a6%82%e4%bd%95%e5%88%a0%e6%8e%89python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/925616.html","title":{"rendered":"\u5982\u4f55\u5220\u6389python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24212730\/75eb45fa-1145-417f-825a-ba6356392fe8.webp\" alt=\"\u5982\u4f55\u5220\u6389python\" \/><\/p>\n<p><p> <strong>\u8981\u5220\u9664Python\uff0c\u4f60\u9700\u8981\u5148\u627e\u5230Python\u7684\u5b89\u88c5\u8def\u5f84\u3001\u4f7f\u7528\u64cd\u4f5c\u7cfb\u7edf\u7684\u5305\u7ba1\u7406\u5668\u6216\u5378\u8f7d\u7a0b\u5e8f\u3002<\/strong>\u5728\u4e0d\u540c\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e2d\uff0c\u5220\u9664Python\u7684\u6b65\u9aa4\u53ef\u80fd\u6709\u6240\u4e0d\u540c\uff0c\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728Windows\u3001macOS\u548cLinux\u7cfb\u7edf\u4e2d\u5220\u9664Python\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001WINDOWS\u7cfb\u7edf\u4e2d\u5220\u9664PYTHON<\/p>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\u5220\u9664Python\u53ef\u4ee5\u901a\u8fc7\u63a7\u5236\u9762\u677f\u6216\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u5b8c\u6210\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u901a\u8fc7\u63a7\u5236\u9762\u677f\u5220\u9664Python<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u63a7\u5236\u9762\u677f\uff1a\u5728Windows\u641c\u7d22\u680f\u4e2d\u8f93\u5165\u201c\u63a7\u5236\u9762\u677f\u201d\u5e76\u6253\u5f00\u3002<\/li>\n<li>\u627e\u5230\u201c\u7a0b\u5e8f\u548c\u529f\u80fd\u201d\uff1a\u5728\u63a7\u5236\u9762\u677f\u4e2d\u9009\u62e9\u201c\u5378\u8f7d\u7a0b\u5e8f\u201d\u6216\u201c\u7a0b\u5e8f\u548c\u529f\u80fd\u201d\u3002<\/li>\n<li>\u627e\u5230Python\u7248\u672c\uff1a\u5728\u5df2\u5b89\u88c5\u7a0b\u5e8f\u5217\u8868\u4e2d\u627e\u5230Python\u7684\u5b89\u88c5\u9879\uff0c\u901a\u5e38\u547d\u540d\u4e3a\u201cPython x.x.x\u201d\uff08x\u4ee3\u8868\u7248\u672c\u53f7\uff09\u3002<\/li>\n<li>\u5378\u8f7dPython\uff1a\u53f3\u952e\u70b9\u51fbPython\u7684\u5b89\u88c5\u9879\uff0c\u9009\u62e9\u201c\u5378\u8f7d\u201d\u5e76\u6309\u7167\u63d0\u793a\u5b8c\u6210\u5378\u8f7d\u8fc7\u7a0b\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u901a\u8fc7\u547d\u4ee4\u884c\u5de5\u5177\u5220\u9664Python<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff1a\u5728Windows\u641c\u7d22\u680f\u4e2d\u8f93\u5165\u201ccmd\u201d\u5e76\u9009\u62e9\u201c\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u201d\u3002<\/li>\n<li>\u67e5\u627ePython\u5b89\u88c5\u8def\u5f84\uff1a\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165<code>where python<\/code>\u547d\u4ee4\uff0c\u67e5\u770bPython\u7684\u5b89\u88c5\u8def\u5f84\u3002<\/li>\n<li>\u5220\u9664Python\u6587\u4ef6\u5939\uff1a\u4f7f\u7528\u547d\u4ee4<code>rmdir \/s \/q &lt;Python\u5b89\u88c5\u8def\u5f84&gt;<\/code>\u6765\u5220\u9664Python\u7684\u5b89\u88c5\u6587\u4ef6\u5939\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001MACOS\u7cfb\u7edf\u4e2d\u5220\u9664PYTHON<\/p>\n<\/p>\n<p><p>\u5728macOS\u4e2d\u5220\u9664Python\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u5de5\u5177Terminal\u5b8c\u6210\uff0c\u56e0\u4e3amacOS\u81ea\u5e26\u7684\u7cfb\u7edfPython\u7248\u672c\u901a\u5e38\u4e0d\u5efa\u8bae\u5220\u9664\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5220\u9664\u7528\u6237\u5b89\u88c5\u7684Python\u7248\u672c<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00Terminal\uff1a\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u627e\u5230Terminal\u5e76\u6253\u5f00\u3002<\/li>\n<li>\u627e\u5230Python\u5b89\u88c5\u8def\u5f84\uff1a\u8f93\u5165<code>which python3<\/code>\u547d\u4ee4\uff0c\u67e5\u770b\u7528\u6237\u5b89\u88c5\u7684Python3\u8def\u5f84\u3002<\/li>\n<li>\u5220\u9664Python\u6587\u4ef6\u5939\uff1a\u4f7f\u7528<code>rm -rf &lt;Python\u5b89\u88c5\u8def\u5f84&gt;<\/code>\u547d\u4ee4\u5220\u9664Python\u5b89\u88c5\u76ee\u5f55\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5220\u9664\u901a\u8fc7Homebrew\u5b89\u88c5\u7684Python<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528Homebrew\u5378\u8f7d\uff1a\u5728Terminal\u4e2d\u8f93\u5165<code>brew uninstall python<\/code>\u547d\u4ee4\uff0c\u5982\u679c\u662f\u901a\u8fc7Homebrew\u5b89\u88c5\u7684Python\uff0cHomebrew\u4f1a\u81ea\u52a8\u5904\u7406\u4f9d\u8d56\u5173\u7cfb\u5e76\u5378\u8f7dPython\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001LINUX\u7cfb\u7edf\u4e2d\u5220\u9664PYTHON<\/p>\n<\/p>\n<p><p>\u5728Linux\u7cfb\u7edf\u4e2d\u5220\u9664Python\u9700\u8981\u6ce8\u610f\uff0c\u56e0\u4e3a\u5f88\u591aLinux\u53d1\u884c\u7248\u4f9d\u8d56\u4e8ePython\u4f5c\u4e3a\u7cfb\u7edf\u7ec4\u4ef6\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5378\u8f7dPython<\/strong><\/p>\n<\/p>\n<ul>\n<li>Debian\/Ubuntu\u7cfb\u7edf\uff1a\u5728Terminal\u4e2d\u8f93\u5165<code>sudo apt-get remove python3<\/code>\uff0c\u4f7f\u7528apt-get\u5305\u7ba1\u7406\u5668\u5378\u8f7dPython3\u3002<\/li>\n<li>Fedora\/RHEL\u7cfb\u7edf\uff1a\u5728Terminal\u4e2d\u8f93\u5165<code>sudo dnf remove python3<\/code>\uff0c\u4f7f\u7528dnf\u5305\u7ba1\u7406\u5668\u5378\u8f7dPython3\u3002<\/li>\n<li>Arch Linux\u7cfb\u7edf\uff1a\u5728Terminal\u4e2d\u8f93\u5165<code>sudo pacman -R python<\/code>\uff0c\u4f7f\u7528pacman\u5305\u7ba1\u7406\u5668\u5378\u8f7dPython\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u624b\u52a8\u5220\u9664Python\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u67e5\u627ePython\u5b89\u88c5\u8def\u5f84\uff1a\u4f7f\u7528<code>which python3<\/code>\u547d\u4ee4\u67e5\u770bPython\u7684\u5b89\u88c5\u8def\u5f84\u3002<\/li>\n<li>\u5220\u9664Python\u6587\u4ef6\u5939\uff1a\u4f7f\u7528<code>rm -rf &lt;Python\u5b89\u88c5\u8def\u5f84&gt;<\/code>\u547d\u4ee4\u5220\u9664Python\u5b89\u88c5\u76ee\u5f55\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u5220\u9664PYTHON\u73af\u5883\u53d8\u91cf<\/p>\n<\/p>\n<p><p>\u65e0\u8bba\u5728\u54ea\u4e2a\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u5220\u9664Python\uff0c\u6700\u540e\u4e00\u6b65\u90fd\u9700\u8981\u68c0\u67e5\u5e76\u5220\u9664Python\u76f8\u5173\u7684\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\uff0c\u4ee5\u514d\u5f71\u54cd\u5230\u7cfb\u7edf\u5176\u4ed6\u5e94\u7528\u7a0b\u5e8f\u7684\u8fd0\u884c\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Windows\u7cfb\u7edf<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\uff1a\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u9009\u62e9\u201c\u5c5e\u6027\u201d\uff0c\u7136\u540e\u70b9\u51fb\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u3002<\/li>\n<li>\u8fdb\u5165\u201c\u73af\u5883\u53d8\u91cf\u201d\u7a97\u53e3\uff1a\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u4e2d\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\u3002<\/li>\n<li>\u5220\u9664Python\u8def\u5f84\uff1a\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u6216\u201c\u7528\u6237\u53d8\u91cf\u201d\u4e2d\u627e\u5230\u5e76\u5220\u9664\u4e0ePython\u76f8\u5173\u7684\u8def\u5f84\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>macOS\u548cLinux\u7cfb\u7edf<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00Terminal\u5e76\u7f16\u8f91bash\u914d\u7f6e\u6587\u4ef6\uff1a\u4f7f\u7528<code>nano ~\/.bash_profile<\/code>\u6216<code>nano ~\/.bashrc<\/code>\u547d\u4ee4\u3002<\/li>\n<li>\u5220\u9664Python\u8def\u5f84\uff1a\u627e\u5230\u5e76\u5220\u9664\u4e0ePython\u76f8\u5173\u7684\u8def\u5f84\u914d\u7f6e\u884c\uff0c\u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fa\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u68c0\u67e5PYTHON\u662f\u5426\u5b8c\u5168\u5220\u9664<\/p>\n<\/p>\n<p><p>\u5b8c\u6210\u4ee5\u4e0a\u6b65\u9aa4\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u68c0\u67e5Python\u662f\u5426\u5df2\u5b8c\u5168\u5220\u9664\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u884c\u5de5\u5177\uff08cmd, Terminal\uff09\u3002<\/li>\n<li>\u8f93\u5165<code>python --version<\/code>\u6216<code>python3 --version<\/code>\u547d\u4ee4\u3002<\/li>\n<li>\u5982\u679c\u663e\u793a\u201ccommand not found\u201d\u6216\u7c7b\u4f3c\u4fe1\u606f\uff0c\u5219\u8bf4\u660ePython\u5df2\u6210\u529f\u5220\u9664\u3002<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u5728\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u6210\u529f\u5220\u9664Python\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5728\u5220\u9664Python\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u6ca1\u6709\u4efb\u4f55\u91cd\u8981\u7684Python\u9879\u76ee\u6216\u73af\u5883\u4f9d\u8d56\u4e8e\u8be5\u5b89\u88c5\u7248\u672c\uff0c\u4ee5\u514d\u5bfc\u81f4\u5de5\u4f5c\u6d41\u4e2d\u65ad\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u786e\u8ba4\u6211\u7684\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5\u4e86\u54ea\u4e9b\u7248\u672c\u7684Python\uff1f<\/strong><br \/>\u8981\u786e\u8ba4\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5\u7684Python\u7248\u672c\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u4e2d\u8f93\u5165<code>python --version<\/code>\u6216<code>python3 --version<\/code>\u3002\u8fd9\u5c06\u663e\u793a\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\u3002\u5982\u679c\u7cfb\u7edf\u4e2d\u6709\u591a\u4e2a\u7248\u672c\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u68c0\u67e5\u5404\u4e2a\u7248\u672c\u7684\u8def\u5f84\u3002<\/p>\n<p><strong>\u5728Windows\u4e0a\u5982\u4f55\u5f7b\u5e95\u5378\u8f7dPython\uff1f<\/strong><br \/>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u63a7\u5236\u9762\u677f\u6765\u5378\u8f7dPython\u3002\u6253\u5f00\u63a7\u5236\u9762\u677f\uff0c\u9009\u62e9\u201c\u7a0b\u5e8f\u548c\u529f\u80fd\u201d\uff0c\u627e\u5230Python\u7684\u5b89\u88c5\u9879\uff0c\u53f3\u952e\u70b9\u51fb\u5e76\u9009\u62e9\u201c\u5378\u8f7d\u201d\u3002\u4e3a\u4e86\u786e\u4fdd\u6240\u6709\u76f8\u5173\u6587\u4ef6\u90fd\u88ab\u5220\u9664\uff0c\u60a8\u8fd8\u53ef\u4ee5\u624b\u52a8\u68c0\u67e5\u548c\u5220\u9664Python\u7684\u5b89\u88c5\u76ee\u5f55\u4ee5\u53ca\u76f8\u5173\u7684\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<p><strong>\u5728Mac\u4e0a\u5982\u4f55\u5220\u9664Python\uff1f<\/strong><br \/>\u5728Mac\u4e0a\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u5220\u9664Python\u3002\u4f7f\u7528<code>brew uninstall python<\/code>\uff08\u5982\u679c\u662f\u901a\u8fc7Homebrew\u5b89\u88c5\u7684\uff09\u6216\u624b\u52a8\u67e5\u627ePython\u7684\u5b89\u88c5\u6587\u4ef6\u5939\u5e76\u5220\u9664\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u6709\u591a\u4e2a\u7248\u672c\u7684Python\uff0c\u786e\u4fdd\u60a8\u5220\u9664\u7684\u662f\u4e0d\u518d\u9700\u8981\u7684\u7248\u672c\u3002\u540c\u65f6\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u66f4\u65b0\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4ee5\u53cd\u6620\u8fd9\u4e9b\u66f4\u6539\u3002<\/p>\n<p><strong>\u5220\u9664Python\u540e\uff0c\u6211\u7684\u9879\u76ee\u4f1a\u53d7\u5230\u5f71\u54cd\u5417\uff1f<\/strong><br \/>\u5220\u9664Python\u53ef\u80fd\u4f1a\u5f71\u54cd\u4f9d\u8d56\u4e8ePython\u7684\u9879\u76ee\u548c\u5e94\u7528\u7a0b\u5e8f\u3002\u5982\u679c\u60a8\u5728\u9879\u76ee\u4e2d\u4f7f\u7528\u4e86Python\u5e93\u6216\u6846\u67b6\uff0c\u5efa\u8bae\u5728\u5378\u8f7d\u4e4b\u524d\u5907\u4efd\u76f8\u5173\u6587\u4ef6\uff0c\u5e76\u786e\u4fdd\u6709\u8ba1\u5212\u5730\u8fc1\u79fb\u5230\u5176\u4ed6\u7f16\u7a0b\u8bed\u8a00\u6216\u73af\u5883\u4e2d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u5220\u9664Python\uff0c\u4f60\u9700\u8981\u5148\u627e\u5230Python\u7684\u5b89\u88c5\u8def\u5f84\u3001\u4f7f\u7528\u64cd\u4f5c\u7cfb\u7edf\u7684\u5305\u7ba1\u7406\u5668\u6216\u5378\u8f7d\u7a0b\u5e8f\u3002\u5728\u4e0d\u540c\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e2d\uff0c [&hellip;]","protected":false},"author":3,"featured_media":925621,"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\/925616"}],"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=925616"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/925616\/revisions"}],"predecessor-version":[{"id":925625,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/925616\/revisions\/925625"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/925621"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=925616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=925616"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=925616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}